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/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/push-api/
10 dictionary PushSubscriptionOptionsInit {
11 // boolean userVisibleOnly = false;
12 (BufferSource or DOMString)? applicationServerKey = null;
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",
20 interface PushManagerImpl {
22 constructor(DOMString scope);
24 Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {});
25 Promise<PushSubscription?> getSubscription();
26 Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {});
29 [Exposed=(Window,Worker), Pref="dom.push.enabled"]
30 interface PushManager {
32 constructor(DOMString scope);
35 Promise<PushSubscription> subscribe(optional PushSubscriptionOptionsInit options = {});
37 Promise<PushSubscription?> getSubscription();
39 Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options = {});
42 enum PushPermissionState