push-api.idl (2999B)
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 interface mixin PushManagerAttribute { 12 readonly attribute PushManager pushManager; 13 }; 14 Window includes PushManagerAttribute; 15 ServiceWorkerRegistration includes PushManagerAttribute; 16 17 [Exposed=(Window,Worker), SecureContext] 18 interface PushManager { 19 [SameObject] static readonly attribute FrozenArray<DOMString> supportedContentEncodings; 20 21 Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {}); 22 Promise<PushSubscription?> getSubscription(); 23 Promise<PermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); 24 }; 25 26 [Exposed=(Window,Worker), SecureContext] 27 interface PushSubscriptionOptions { 28 readonly attribute boolean userVisibleOnly; 29 [SameObject] readonly attribute ArrayBuffer? applicationServerKey; 30 }; 31 32 dictionary PushSubscriptionOptionsInit { 33 boolean userVisibleOnly = false; 34 (BufferSource or DOMString)? applicationServerKey = null; 35 }; 36 37 [Exposed=(Window,Worker), SecureContext] 38 interface PushSubscription { 39 readonly attribute USVString endpoint; 40 readonly attribute EpochTimeStamp? expirationTime; 41 [SameObject] readonly attribute PushSubscriptionOptions options; 42 ArrayBuffer? getKey(PushEncryptionKeyName name); 43 Promise<boolean> unsubscribe(); 44 45 PushSubscriptionJSON toJSON(); 46 }; 47 48 dictionary PushSubscriptionJSON { 49 USVString endpoint; 50 EpochTimeStamp? expirationTime = null; 51 record<DOMString, USVString> keys; 52 }; 53 54 enum PushEncryptionKeyName { 55 "p256dh", 56 "auth" 57 }; 58 59 [Exposed=ServiceWorker, SecureContext] 60 interface PushMessageData { 61 ArrayBuffer arrayBuffer(); 62 Blob blob(); 63 Uint8Array bytes(); 64 any json(); 65 USVString text(); 66 }; 67 68 [Exposed=ServiceWorker, SecureContext] 69 partial interface ServiceWorkerGlobalScope { 70 attribute EventHandler onpush; 71 attribute EventHandler onpushsubscriptionchange; 72 }; 73 74 [Exposed=ServiceWorker, SecureContext] 75 interface PushEvent : ExtendableEvent { 76 constructor(DOMString type, optional PushEventInit eventInitDict = {}); 77 readonly attribute PushMessageData? data; 78 readonly attribute Notification? notification; 79 }; 80 81 dictionary PushEventInit : ExtendableEventInit { 82 PushMessageDataInit? data = null; 83 Notification? notification = null; 84 }; 85 86 typedef (BufferSource or USVString) PushMessageDataInit; 87 88 [Exposed=ServiceWorker, SecureContext] 89 interface PushSubscriptionChangeEvent : ExtendableEvent { 90 constructor(DOMString type, optional PushSubscriptionChangeEventInit eventInitDict = {}); 91 readonly attribute PushSubscription? newSubscription; 92 readonly attribute PushSubscription? oldSubscription; 93 }; 94 95 dictionary PushSubscriptionChangeEventInit : ExtendableEventInit { 96 PushSubscription newSubscription = null; 97 PushSubscription oldSubscription = null; 98 };