Victor Porof | 6e09692 | 2022-06-10 13:01:05 +0000 | [diff] [blame] | 1 | // 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 | |
| 6 | dictionary PushPermissionDescriptor : PermissionDescriptor { |
| 7 | boolean userVisibleOnly = false; |
| 8 | }; |
| 9 | |
| 10 | [SecureContext] |
| 11 | partial interface ServiceWorkerRegistration { |
| 12 | readonly attribute PushManager pushManager; |
| 13 | }; |
| 14 | |
| 15 | [Exposed=(Window,Worker), SecureContext] |
| 16 | interface 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] |
| 25 | interface PushSubscriptionOptions { |
| 26 | readonly attribute boolean userVisibleOnly; |
| 27 | [SameObject] readonly attribute ArrayBuffer? applicationServerKey; |
| 28 | }; |
| 29 | |
| 30 | dictionary PushSubscriptionOptionsInit { |
| 31 | boolean userVisibleOnly = false; |
| 32 | (BufferSource or DOMString)? applicationServerKey = null; |
| 33 | }; |
| 34 | |
| 35 | [Exposed=(Window,Worker), SecureContext] |
| 36 | interface 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 | |
| 46 | dictionary PushSubscriptionJSON { |
| 47 | USVString endpoint; |
| 48 | EpochTimeStamp? expirationTime = null; |
| 49 | record<DOMString, USVString> keys; |
| 50 | }; |
| 51 | |
| 52 | enum PushEncryptionKeyName { |
| 53 | "p256dh", |
| 54 | "auth" |
| 55 | }; |
| 56 | |
| 57 | [Exposed=ServiceWorker, SecureContext] |
| 58 | interface PushMessageData { |
| 59 | ArrayBuffer arrayBuffer(); |
| 60 | Blob blob(); |
| 61 | any json(); |
| 62 | USVString text(); |
| 63 | }; |
| 64 | |
| 65 | [Exposed=ServiceWorker, SecureContext] |
| 66 | partial interface ServiceWorkerGlobalScope { |
| 67 | attribute EventHandler onpush; |
| 68 | attribute EventHandler onpushsubscriptionchange; |
| 69 | }; |
| 70 | |
| 71 | [Exposed=ServiceWorker, SecureContext] |
| 72 | interface PushEvent : ExtendableEvent { |
| 73 | constructor(DOMString type, optional PushEventInit eventInitDict = {}); |
| 74 | readonly attribute PushMessageData? data; |
| 75 | }; |
| 76 | |
| 77 | typedef (BufferSource or USVString) PushMessageDataInit; |
| 78 | |
| 79 | dictionary PushEventInit : ExtendableEventInit { |
| 80 | PushMessageDataInit data; |
| 81 | }; |
| 82 | |
| 83 | [Exposed=ServiceWorker, SecureContext] |
| 84 | interface PushSubscriptionChangeEvent : ExtendableEvent { |
| 85 | constructor(DOMString type, optional PushSubscriptionChangeEventInit eventInitDict = {}); |
| 86 | readonly attribute PushSubscription? newSubscription; |
| 87 | readonly attribute PushSubscription? oldSubscription; |
| 88 | }; |
| 89 | |
| 90 | dictionary PushSubscriptionChangeEventInit : ExtendableEventInit { |
| 91 | PushSubscription newSubscription = null; |
| 92 | PushSubscription oldSubscription = null; |
| 93 | }; |