PushManager.webidl (1953B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://w3c.github.io/push-api/ 8 */ 9 10 dictionary PushSubscriptionOptionsInit { 11 // boolean userVisibleOnly = false; 12 (BufferSource or DOMString)? applicationServerKey = null; 13 }; 14 15 // The main thread JS implementation. Please see comments in 16 // dom/push/PushManager.h for the split between PushManagerImpl and PushManager. 17 [JSImplementation="@mozilla.org/push/PushManager;1", 18 ChromeOnly, 19 Exposed=Window] 20 interface PushManagerImpl { 21 [Throws] 22 constructor(DOMString scope); 23 24 Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {}); 25 Promise<PushSubscription?> getSubscription(); 26 Promise<PermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); 27 }; 28 29 [Exposed=(Window,Worker), Func="PushManager::IsEnabled"] 30 interface PushManager { 31 [Throws, ChromeOnly] 32 constructor(DOMString scope); 33 34 // TODO: Use FrozenArray once available. (Bug 1236777) 35 // [SameObject] static readonly attribute FrozenArray<DOMString> supportedContentEncodings; 36 // XXX: We can't use sequence here either: 37 // 1. [Cached] is not supported for static members (Bug 1363870) 38 // 2. [Cached] is required for sequence typed attributes 39 // [Frozen, Cached, Pure] static readonly attribute sequence<DOMString> supportedContentEncodings; 40 [Throws] static readonly attribute object supportedContentEncodings; 41 42 [Throws, UseCounter] 43 Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {}); 44 [Throws] 45 Promise<PushSubscription?> getSubscription(); 46 [Throws] 47 Promise<PermissionState> permissionState(optional PushSubscriptionOptionsInit options = {}); 48 };