forked from rescript-lang/experimental-rescript-webapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushAPI.res
More file actions
90 lines (78 loc) · 2.47 KB
/
PushAPI.res
File metadata and controls
90 lines (78 loc) · 2.47 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
@@warning("-30")
open EventAPI
type permissionState =
| @as("denied") Denied
| @as("granted") Granted
| @as("prompt") Prompt
type pushEncryptionKeyName =
| @as("auth") Auth
| @as("p256dh") P256dh
/**
This Push API interface provides a way to receive notifications from third-party servers as well as request URLs for push notifications.
[See PushManager on MDN](https://developer.mozilla.org/docs/Web/API/PushManager)
*/
@editor.completeFrom(PushManager)
type pushManager = {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushManager/supportedContentEncodings_static)
*/
supportedContentEncodings: array<string>,
}
type applicationServerKey
/**
[See PushSubscriptionOptions on MDN](https://developer.mozilla.org/docs/Web/API/PushSubscriptionOptions)
*/
type pushSubscriptionOptions = {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushSubscriptionOptions/userVisibleOnly)
*/
userVisibleOnly: bool,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushSubscriptionOptions/applicationServerKey)
*/
applicationServerKey: applicationServerKey,
}
/**
This Push API interface provides a subcription's URL endpoint and allows unsubscription from a push service.
[See PushSubscription on MDN](https://developer.mozilla.org/docs/Web/API/PushSubscription)
*/
@editor.completeFrom(PushSubscription)
type pushSubscription = {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushSubscription/endpoint)
*/
endpoint: string,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushSubscription/expirationTime)
*/
expirationTime: Null.t<int>,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushSubscription/options)
*/
options: pushSubscriptionOptions,
}
type pushSubscriptionOptionsInit = {
mutable userVisibleOnly?: bool,
mutable applicationServerKey?: applicationServerKey,
}
type pushSubscriptionJSONKeys = {
/** Base64URL-encoded ArrayBuffer value */
p256dh: string,
/** Base64URL-encoded ArrayBuffer value */
auth: string,
}
type pushSubscriptionJSON = {
mutable endpoint?: string,
mutable expirationTime?: Null.t<int>,
mutable keys?: pushSubscriptionJSONKeys,
}
@editor.completeFrom(PushMessageData)
type pushMessageData
@editor.completeFrom(PushEvent)
type pushEvent = {
...extendableEvent,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushEvent/data)
*/
data?: pushMessageData,
}