ServiceWorkerRegistration.webidl (2048B)
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 * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html 8 * https://w3c.github.io/push-api/ 9 * https://notifications.spec.whatwg.org/ 10 * https://wicg.github.io/cookie-store/#idl-index 11 */ 12 13 [Func="ServiceWorkersEnabled", 14 Exposed=(Window,Worker)] 15 interface ServiceWorkerRegistration : EventTarget { 16 readonly attribute ServiceWorker? installing; 17 readonly attribute ServiceWorker? waiting; 18 readonly attribute ServiceWorker? active; 19 20 [Pref="dom.serviceWorkers.navigationPreload.enabled", SameObject] 21 readonly attribute NavigationPreloadManager navigationPreload; 22 23 readonly attribute USVString scope; 24 [Throws] 25 readonly attribute ServiceWorkerUpdateViaCache updateViaCache; 26 27 [Throws, NewObject] 28 Promise<undefined> update(); 29 30 [Throws, NewObject] 31 Promise<boolean> unregister(); 32 33 // event 34 attribute EventHandler onupdatefound; 35 }; 36 37 enum ServiceWorkerUpdateViaCache { 38 "imports", 39 "all", 40 "none" 41 }; 42 43 // https://w3c.github.io/push-api/ 44 partial interface ServiceWorkerRegistration { 45 [Throws, Exposed=(Window,Worker), Pref="dom.push.enabled"] 46 readonly attribute PushManager pushManager; 47 }; 48 49 // https://notifications.spec.whatwg.org/ 50 partial interface ServiceWorkerRegistration { 51 [NewObject, Func="mozilla::dom::Notification::PrefEnabled"] 52 Promise<undefined> showNotification(DOMString title, optional NotificationOptions options = {}); 53 [NewObject, Func="mozilla::dom::Notification::PrefEnabled"] 54 Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter = {}); 55 }; 56 57 partial interface ServiceWorkerRegistration { 58 [Throws, SameObject, Exposed=(ServiceWorker,Window), Pref="dom.cookieStore.enabled"] 59 readonly attribute CookieStoreManager cookies; 60 };