-
Notifications
You must be signed in to change notification settings - Fork 72
/
push-api.idl
93 lines (76 loc) · 2.71 KB
/
push-api.idl
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
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: Push API (https://w3c.github.io/push-api/)
[SecureContext]
partial interface ServiceWorkerRegistration {
readonly attribute PushManager pushManager;
};
[Exposed=(Window,Worker), SecureContext]
interface PushManager {
[SameObject] static readonly attribute FrozenArray<DOMString> supportedContentEncodings;
Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {});
Promise<PushSubscription?> getSubscription();
Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {});
};
[Exposed=(Window,Worker), SecureContext]
interface PushSubscriptionOptions {
readonly attribute boolean userVisibleOnly;
[SameObject] readonly attribute ArrayBuffer? applicationServerKey;
};
dictionary PushSubscriptionOptionsInit {
boolean userVisibleOnly = false;
(BufferSource or DOMString)? applicationServerKey = null;
};
[Exposed=(Window,Worker), SecureContext]
interface PushSubscription {
readonly attribute USVString endpoint;
readonly attribute DOMTimeStamp? expirationTime;
[SameObject] readonly attribute PushSubscriptionOptions options;
ArrayBuffer? getKey(PushEncryptionKeyName name);
Promise<boolean> unsubscribe();
PushSubscriptionJSON toJSON();
};
dictionary PushSubscriptionJSON {
USVString endpoint;
DOMTimeStamp? expirationTime;
record<DOMString, USVString> keys;
};
enum PushEncryptionKeyName {
"p256dh",
"auth"
};
[Exposed=ServiceWorker, SecureContext]
interface PushMessageData {
ArrayBuffer arrayBuffer();
Blob blob();
any json();
USVString text();
};
[Exposed=ServiceWorker, SecureContext]
partial interface ServiceWorkerGlobalScope {
attribute EventHandler onpush;
attribute EventHandler onpushsubscriptionchange;
};
[Constructor(DOMString type, optional PushEventInit eventInitDict = {}), Exposed=ServiceWorker, SecureContext]
interface PushEvent : ExtendableEvent {
readonly attribute PushMessageData? data;
};
typedef (BufferSource or USVString) PushMessageDataInit;
dictionary PushEventInit : ExtendableEventInit {
PushMessageDataInit data;
};
[Constructor(DOMString type, optional PushSubscriptionChangeEventInit eventInitDict = {}), Exposed=ServiceWorker, SecureContext]
interface PushSubscriptionChangeEvent : ExtendableEvent {
readonly attribute PushSubscription? newSubscription;
readonly attribute PushSubscription? oldSubscription;
};
dictionary PushSubscriptionChangeEventInit : ExtendableEventInit {
PushSubscription newSubscription = null;
PushSubscription oldSubscription = null;
};
enum PushPermissionState {
"denied",
"granted",
"prompt",
};