-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathNotificationAPI.res
More file actions
109 lines (100 loc) · 3.02 KB
/
NotificationAPI.res
File metadata and controls
109 lines (100 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
@@warning("-30")
open EventAPI
type notificationDirection =
| @as("auto") Auto
| @as("ltr") Ltr
| @as("rtl") Rtl
type notificationPermission =
| @as("default") Default
| @as("denied") Denied
| @as("granted") Granted
/**
This Notifications API interface is used to configure and display desktop notifications to the user.
[See Notification on MDN](https://developer.mozilla.org/docs/Web/API/Notification)
*/
@editor.completeFrom(Notification)
type notification = {
...eventTarget,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/permission_static)
*/
permission: notificationPermission,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/title)
*/
title: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/dir)
*/
dir: notificationDirection,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/lang)
*/
lang: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/body)
*/
body: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/tag)
*/
tag: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/icon)
*/
icon: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/badge)
*/
badge: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/silent)
*/
silent: Null.t<bool>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/requireInteraction)
*/
requireInteraction: bool,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Notification/data)
*/
data?: JSON.t,
}
/**
An array of actions to display in the notification, for which the default is an empty array.
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#actions)
*/
type notificationAction = {
action: string,
title: string,
icon?: string,
}
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,
mutable actions?: array<notificationAction>,
/**
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#vibrate)
*/
mutable vibrate?: array<int>,
}
type getNotificationOptions = {mutable tag?: string}
type notificationPermissionCallback = notificationPermission => unit
type notificationEvent = {
...extendableEvent,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/NotificationEvent/action)
*/
action: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/NotificationEvent/notification)
*/
notification: notification,
}