package js_of_ocaml
Module Js_of_ocaml.NotificationSource
Notifications API.
A code example:
if Notification.is_supported ()
then
ignore
(Promise.map
(fun perm ->
if Js.to_string perm = "granted"
then
let options = Notification.empty_options () in
options##.body := Js.string "Hello from OCaml!";
ignore (new%js Notification.notification_with_options
(Js.string "Title") options))
(Notification.request_permission ()))A single action shown alongside a (persistent) notification. Used both when building notificationOptions and when reading notification's actions; the members are therefore read-write.
Initializer for notification. All fields are optional; create an empty record with empty_options and populate the ones you need.
Source
val notification_with_options :
(Js.js_string Js.t ->
notificationOptions Js.t ->
notification Js.t)
Js.constrThe current permission to display notifications: "granted", "denied" or "default".
The maximum number of actions supported by notifications on this device.
Request permission from the user to display notifications. The promise resolves with the new permission value (see permission).
Whether the Notification global is available in the current environment.