blob: f582788806c79223f9a7b935ce48c179ac247cd9 [file] [log] [blame]
Victor Porof6e096922022-06-10 13:01:05 +00001// GENERATED CONTENT - DO NOT EDIT
2// Content was automatically extracted by Reffy into webref
3// (https://github.com/w3c/webref)
4// Source: Push API (https://w3c.github.io/push-api/)
5
6dictionary PushPermissionDescriptor : PermissionDescriptor {
7 boolean userVisibleOnly = false;
8};
9
10[SecureContext]
11partial interface ServiceWorkerRegistration {
12 readonly attribute PushManager pushManager;
13};
14
15[Exposed=(Window,Worker), SecureContext]
16interface PushManager {
17 [SameObject] static readonly attribute FrozenArray<DOMString> supportedContentEncodings;
18
19 Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {});
20 Promise<PushSubscription?> getSubscription();
21 Promise<PermissionState> permissionState(optional PushSubscriptionOptionsInit options = {});
22};
23
24[Exposed=(Window,Worker), SecureContext]
25interface PushSubscriptionOptions {
26 readonly attribute boolean userVisibleOnly;
27 [SameObject] readonly attribute ArrayBuffer? applicationServerKey;
28};
29
30dictionary PushSubscriptionOptionsInit {
31 boolean userVisibleOnly = false;
32 (BufferSource or DOMString)? applicationServerKey = null;
33};
34
35[Exposed=(Window,Worker), SecureContext]
36interface PushSubscription {
37 readonly attribute USVString endpoint;
38 readonly attribute EpochTimeStamp? expirationTime;
39 [SameObject] readonly attribute PushSubscriptionOptions options;
40 ArrayBuffer? getKey(PushEncryptionKeyName name);
41 Promise<boolean> unsubscribe();
42
43 PushSubscriptionJSON toJSON();
44};
45
46dictionary PushSubscriptionJSON {
47 USVString endpoint;
48 EpochTimeStamp? expirationTime = null;
49 record<DOMString, USVString> keys;
50};
51
52enum PushEncryptionKeyName {
53 "p256dh",
54 "auth"
55};
56
57[Exposed=ServiceWorker, SecureContext]
58interface PushMessageData {
59 ArrayBuffer arrayBuffer();
60 Blob blob();
61 any json();
62 USVString text();
63};
64
65[Exposed=ServiceWorker, SecureContext]
66partial interface ServiceWorkerGlobalScope {
67 attribute EventHandler onpush;
68 attribute EventHandler onpushsubscriptionchange;
69};
70
71[Exposed=ServiceWorker, SecureContext]
72interface PushEvent : ExtendableEvent {
73 constructor(DOMString type, optional PushEventInit eventInitDict = {});
74 readonly attribute PushMessageData? data;
75};
76
77typedef (BufferSource or USVString) PushMessageDataInit;
78
79dictionary PushEventInit : ExtendableEventInit {
80 PushMessageDataInit data;
81};
82
83[Exposed=ServiceWorker, SecureContext]
84interface PushSubscriptionChangeEvent : ExtendableEvent {
85 constructor(DOMString type, optional PushSubscriptionChangeEventInit eventInitDict = {});
86 readonly attribute PushSubscription? newSubscription;
87 readonly attribute PushSubscription? oldSubscription;
88};
89
90dictionary PushSubscriptionChangeEventInit : ExtendableEventInit {
91 PushSubscription newSubscription = null;
92 PushSubscription oldSubscription = null;
93};