Module Brr_io.Notification

Notifying users.

See the Notification API.


module Permission : sig ... end

Permission enum.

val permission : unit -> Permission.t

permission () is the permission granted by the user.

val request_permission : unit -> Permission.t Fut.or_error

request_permission () requests permission to display notifications.


module Direction : sig ... end

Direction enum.

module Action : sig ... end


type opts

The type for notification options.

val opts : ?⁠dir:Direction.t -> ?⁠lang:Jstr.t -> ?⁠body:Jstr.t -> ?⁠tag:Jstr.t -> ?⁠image:Jstr.t -> ?⁠icon:Jstr.t -> ?⁠badge:Jstr.t -> ?⁠timestamp_ms:int -> ?⁠renotify:bool -> ?⁠silent:bool -> ?⁠require_interaction:bool -> ?⁠data:'a -> ?⁠actions:Action.t list -> unit -> opts
type t

The type for Notification objects.

type notification = t

See t .

val create : ?⁠opts:opts -> Jstr.t -> t

create title ~opts is a notification with title title and options opts.

val close : t -> unit

close n closes n.

val as_target : t ->

as_target n is n as an event target.


val actions : t -> Action.t list

action n are the actions of n.

val badge : t -> Jstr.t

badge n is the badge of n.

val body : t -> Jstr.t

body n is the body of n.

val data : t -> 'a

data n is the data of n. Warning. This is unsafe, constrain the result type.

val dir : t -> Direction.t

dir n is the dir of n.

val lang : t -> Jstr.t

lang n is the lang of n.

val tag : t -> Jstr.t

tag n is the tag of n.

val icon : t -> Jstr.t

icon n is the icon of n.

val image : t -> Jstr.t

image n is the image of n.

val renotify : t -> bool

renotify n indicates n replaces an old notification.

val require_interaction : t -> bool

require_interaction n indicates n requires interaction.

val silent : t -> bool

silent n indicates n should be silent.

val timestamp_ms : t -> int

timestamp_ms n is the timestamp of n.

val title : t -> Jstr.t

title n is the title of n.


module Ev : sig ... end

Notification events.