Notification
Types
getNotificationOptions
type getNotificationOptions = WebAPI.NotificationTypes.getNotificationOptions = { mutable tag?: string,}Record fields
tag
notificationAction
type notificationAction = WebAPI.NotificationTypes.notificationAction = { action: string, title: string, icon?: string,}Record fields
action
title
icon
notificationDirection
type notificationDirection = WebAPI.NotificationTypes.notificationDirectionnotificationEvent
type notificationEvent = WebAPI.NotificationTypes.notificationEvent = { type_: WebAPI.EventType.t, target: Null.t<WebAPI.DOM.eventTarget>, currentTarget: Null.t<WebAPI.DOM.eventTarget>, eventPhase: int, bubbles: bool, cancelable: bool, defaultPrevented: bool, composed: bool, isTrusted: bool, timeStamp: float, action: string, notification: WebAPI.NotificationTypes.notification,}Record fields
type_
Returns the type of event, e.g. "click", "hashchange", or "submit". Read more on MDN
target
Returns the object to which event is dispatched (its target). Read more on MDN
currentTarget
Returns the object whose event listener's callback is currently being invoked. Read more on MDN
eventPhase
Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. Read more on MDN
bubbles
Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. Read more on MDN
cancelable
Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. Read more on MDN
defaultPrevented
Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. Read more on MDN
composed
Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. Read more on MDN
isTrusted
Returns true if event was dispatched by the user agent, and false otherwise. Read more on MDN
timeStamp
Returns the event's timestamp as the number of milliseconds measured relative to the time origin. Read more on MDN
notificationOptions
type notificationOptions = WebAPI.NotificationTypes.notificationOptions = { mutable dir?: WebAPI.NotificationTypes.notificationDirection, mutable lang?: string, mutable body?: string, mutable tag?: string, mutable icon?: string, mutable badge?: string, mutable silent?: Nullable.t<bool>, mutable requireInteraction?: bool, mutable data?: JSON.t, mutable actions?: array< WebAPI.NotificationTypes.notificationAction, >, mutable vibrate?: array<int>,}Record fields
lang
body
tag
icon
badge
silent
requireInteraction
data
actions
notificationPermission
type notificationPermission = WebAPI.NotificationTypes.notificationPermissionnotificationPermissionCallback
type notificationPermissionCallback = WebAPI.NotificationTypes.notificationPermissionCallbackt
type t = WebAPI.NotificationTypes.notification = { permission: WebAPI.NotificationTypes.notificationPermission, title: string, dir: WebAPI.NotificationTypes.notificationDirection, lang: string, body: string, tag: string, icon: string, badge: string, silent: Null.t<bool>, requireInteraction: bool, data?: JSON.t,}Record fields
Values
addEventListener
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN
let addEventListener: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>, ~options: WebAPI.DOM.EventListener.addEventListenerOptions=?,) => unitParameters
tWebAPI.EventType.tWebAPI.DOM.EventListener.toption<WebAPI.DOM.EventListener.addEventListenerOptions>Return type
unitaddEventListenerWithCapture
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN
let addEventListenerWithCapture: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>,) => unitasEventTarget
let asEventTarget: t => WebAPI.DOM.eventTargetdispatchEvent
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. Read more on MDN
let dispatchEvent: (t, WebAPI.DOM.event) => boolmake
let make: (~title: string, ~options: notificationOptions=?) => tremoveEventListener
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListener: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>, ~options: WebAPI.DOM.EventListener.options=?,) => unitParameters
tWebAPI.EventType.tWebAPI.DOM.EventListener.toption<WebAPI.DOM.EventListener.options>Return type
unitremoveEventListenerUseCapture
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListenerUseCapture: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>,) => unitrequestPermission
let requestPermission: ( ~deprecatedCallback: notificationPermissionCallback=?,) => promise<notificationPermission>