aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls/ServiceWorkerContainer.webidl
blob: 6d183619af8e619a72496a7597c4bff58594c764 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// https://w3c.github.io/ServiceWorker/#service-worker-container
[Pref="dom.serviceworker.enabled", Exposed=(Window,Worker)]
interface ServiceWorkerContainer : EventTarget {
  [Unforgeable] readonly attribute ServiceWorker? controller;
  //[SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready;

  [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options);

  //[NewObject] /*Promise<any>*/ any getRegistration(optional USVString clientURL = "");
  //[NewObject] /* Promise */<sequence<ServiceWorkerRegistration>> getRegistrations();


  // events
  //attribute EventHandler oncontrollerchange;
  //attribute EventHandler onerror;
  //attribute EventHandler onmessage; // event.source of message events is ServiceWorker object
};

dictionary RegistrationOptions {
  USVString scope;
  //WorkerType type = "classic";
};