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 * http://w3c.github.io/push-api/
9 * https://notifications.spec.whatwg.org/
10 *
11 * You are granted a license to use, reproduce and create derivative works of
12 * this document.
13 */
14
15[Global=(Worker,ServiceWorker),
16 Exposed=ServiceWorker]
17interface ServiceWorkerGlobalScope : WorkerGlobalScope {
18  [SameObject, BinaryName="GetClients"]
19  readonly attribute Clients clients;
20  [SameObject] readonly attribute ServiceWorkerRegistration registration;
21
22  [Throws, NewObject]
23  Promise<void> skipWaiting();
24
25  attribute EventHandler oninstall;
26  attribute EventHandler onactivate;
27
28  attribute EventHandler onfetch;
29
30  // The event.source of these MessageEvents are instances of Client
31  attribute EventHandler onmessage;
32};
33
34// These are from w3c.github.io/push-api/
35partial interface ServiceWorkerGlobalScope {
36  attribute EventHandler onpush;
37  attribute EventHandler onpushsubscriptionchange;
38};
39
40// https://notifications.spec.whatwg.org/
41partial interface ServiceWorkerGlobalScope {
42  attribute EventHandler onnotificationclick;
43  attribute EventHandler onnotificationclose;
44};
45