WebIDLpedia

ServiceWorker Global name

Definition

Realm execution contexts tied to the ServiceWorker Global name use ServiceWorkerGlobalScope as a basis for their global object.

This means their global object exposes the following members:


  [SameObject] readonly attribute Clients clients;
  [SameObject] readonly attribute ServiceWorkerRegistration registration;
  [SameObject] readonly attribute ServiceWorker serviceWorker;

  [NewObject] Promise<undefined> skipWaiting();

  attribute EventHandler oninstall;
  attribute EventHandler onactivate;
  attribute EventHandler onfetch;

  attribute EventHandler onmessage;
  attribute EventHandler onmessageerror;
  attribute EventHandler onnotificationclick;
  attribute EventHandler onnotificationclose;
  attribute EventHandler onbackgroundfetchsuccess;
  attribute EventHandler onbackgroundfetchfail;
  attribute EventHandler onbackgroundfetchabort;
  attribute EventHandler onbackgroundfetchclick;
  attribute EventHandler onsync;
  attribute EventHandler oncontentdelete;
  [SameObject] readonly attribute CookieStore cookieStore;

  attribute EventHandler oncookiechange;
    attribute EventHandler onperiodicsync;
  attribute EventHandler oncanmakepayment;
  attribute EventHandler onpaymentrequest;
  attribute EventHandler onpush;
  attribute EventHandler onpushsubscriptionchange;
  readonly attribute WorkerGlobalScope self;
  readonly attribute WorkerLocation location;
  readonly attribute WorkerNavigator navigator;
  undefined importScripts((TrustedScriptURL or USVString)... urls);

  attribute OnErrorEventHandler onerror;
  attribute EventHandler onlanguagechange;
  attribute EventHandler onoffline;
  attribute EventHandler ononline;
  attribute EventHandler onrejectionhandled;
  attribute EventHandler onunhandledrejection;

  undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
  undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
  boolean dispatchEvent(Event event);

The following interfaces are exposed exclusively in the corresponding realms:

The following interfaces are also exposed in the corresponding realms: