Skip to content

NotificationAPI

Types

getNotificationOptions

type getNotificationOptions = {mutable tag?: string}

Record fields

tag
option< string >

notification

This Notifications API interface is used to configure and display desktop notifications to the user. See Notification on MDN

type notification = {
permission: notificationPermission,
title: string,
dir: notificationDirection,
lang: string,
body: string,
tag: string,
icon: string,
badge: string,
silent: Null.t<bool>,
requireInteraction: bool,
data: JSON.t,
}

Record fields

title
string
lang
string
body
string
tag
string
icon
string
badge
string
silent
Null.t< bool >
requireInteraction
bool
data
JSON.t

Module

There are methods and helpers defined in Notification .

notificationDirection

type notificationDirection =
| @as("auto") Auto
| @as("ltr") Ltr
| @as("rtl") Rtl

notificationOptions

type notificationOptions = {
mutable dir?: notificationDirection,
mutable lang?: string,
mutable body?: string,
mutable tag?: string,
mutable icon?: string,
mutable badge?: string,
mutable silent?: Null.t<bool>,
mutable requireInteraction?: bool,
mutable data?: JSON.t,
}

Record fields

dir
lang
option< string >
body
option< string >
tag
option< string >
icon
option< string >
badge
option< string >
silent
option< Null.t< bool > >
requireInteraction
option< bool >
data
option< JSON.t >

notificationPermission

type notificationPermission =
| @as("default") Default
| @as("denied") Denied
| @as("granted") Granted

notificationPermissionCallback

type notificationPermissionCallback = notificationPermission => unit