trait ServiceWorkerGlobalScope extends raw.EventTarget with WorkerGlobalScope

The ServiceWorkerGlobalScope interface of the ServiceWorker API represents the global execution context of a service worker.

Developers should keep in mind that the ServiceWorker.state is not persisted across the termination/restart cycle, so each event handler should assume it's being invoked with a bare, default global state.

Once successfully registered, a service worker can and will be terminated when idle to conserve memory and processor power. An active service worker is automatically restarted to respond to events, such as ServiceWorkerGlobalScope.onfetch or ServiceWorkerGlobalScope.onmessage.

Additionally, synchronous requests are not allowed from within a service worker — only asynchronous requests, like those initiated via the fetch() method, can be used.

MDN

Annotations
@RawJSType() @native()
Linear Supertypes
WorkerGlobalScope, raw.EventTarget, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ServiceWorkerGlobalScope
  2. WorkerGlobalScope
  3. EventTarget
  4. Object
  5. Any
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addEventListener[T <: raw.Event](type: String, listener: Function1[T, _], options: EventListenerOptions): Unit

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on.

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

    This implementation accepts a settings object of type EventListenerOptions.

    MDN

    Definition Classes
    EventTarget
  5. def addEventListener[T <: raw.Event](type: String, listener: Function1[T, _], useCapture: Boolean = js.native): Unit

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on.

    The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

    MDN

    Definition Classes
    EventTarget
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def caches: CacheStorage

    Returns the CacheStorage object associated with the service worker.

    Returns the CacheStorage object associated with the service worker.

    MDN

    Definition Classes
    ServiceWorkerGlobalScopeWorkerGlobalScope
  8. def clients: Clients

    Returns the Clients object associated with the service worker.

    Returns the Clients object associated with the service worker.

    MDN

  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  10. def close(): Unit

    The close() method of the WorkerGlobalScope interface discards any tasks queued in the WorkerGlobalScope's event loop, effectively closing this particular scope.

    The close() method of the WorkerGlobalScope interface discards any tasks queued in the WorkerGlobalScope's event loop, effectively closing this particular scope.

    MDN

    Definition Classes
    WorkerGlobalScope
  11. def dispatchEvent(evt: raw.Event): Boolean

    Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order.

    Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

    MDN

    Definition Classes
    EventTarget
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hasOwnProperty(v: String): Boolean
    Definition Classes
    Object
  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def importScripts(urls: Array[String]): Unit

    The importScripts() method of the WorkerGlobalScope interface imports one or more scripts into the worker's scope.

    The importScripts() method of the WorkerGlobalScope interface imports one or more scripts into the worker's scope.

    MDN

    Definition Classes
    WorkerGlobalScope
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  21. def location: WorkerLocation

    The location read-only property of the WorkerGlobalScope interface returns the WorkerLocation associated with the worker.

    The location read-only property of the WorkerGlobalScope interface returns the WorkerLocation associated with the worker. It is a specific location object, mostly a subset of the Location for browsing scopes, but adapted to workers.

    MDN

    Definition Classes
    WorkerGlobalScope
  22. def navigator: WorkerNavigator

    The navigator read-only property of the WorkerGlobalScope interface returns the WorkerNavigator associated with the worker.

    The navigator read-only property of the WorkerGlobalScope interface returns the WorkerNavigator associated with the worker. It is a specific navigator object, mostly a subset of the Navigator for browsing scopes, but adapted to workers.

    MDN

    Definition Classes
    WorkerGlobalScope
  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. val onError: Function1[raw.ErrorEvent, _]

    The onerror property of the WorkerGlobalScope interface represents an EventHandler to be called when the error event occurs and bubbles through the Worker.

    The onerror property of the WorkerGlobalScope interface represents an EventHandler to be called when the error event occurs and bubbles through the Worker.

    MDN

    Definition Classes
    WorkerGlobalScope
  27. val onactivate: Function1[ExtendableEvent, _]

    An event handler fired whenever an activate event occurs (when the service worker activates).

    An event handler fired whenever an activate event occurs (when the service worker activates). This happens after installation, when the page to be controlled by the service worker refreshes.

    MDN

  28. val onfetch: Function1[FetchEvent, _]

    An event handler fired whenever a fetch event occurs — when a fetch() is called.

    An event handler fired whenever a fetch event occurs — when a fetch() is called.

    MDN

  29. val oninstall: Function1[ExtendableEvent, _]

    An event handler fired whenever an install event occurs — when a ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.installing worker.

    An event handler fired whenever an install event occurs — when a ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.installing worker.

    MDN

  30. val onlanguagechange: Function1[raw.Event, _]

    The onlanguagechange property of the WorkerGlobalScope interface represents an EventHandler to be called when the languagechange event occurs and bubbles through the Worker.

    The onlanguagechange property of the WorkerGlobalScope interface represents an EventHandler to be called when the languagechange event occurs and bubbles through the Worker.

    MDN

    Definition Classes
    WorkerGlobalScope
  31. val onmessage: Function1[MessageEvent, _]

    An event handler fired whenever a message event occurs — when incoming messages are received.

    An event handler fired whenever a message event occurs — when incoming messages are received. Controlled pages can use the MessagePort.postMessage method to send messages to service workers. The service worker can optionally send a response back via the MessagePort exposed in event.data.port, corresponding to the controlled page.

    MDN

  32. val onoffline: Function1[raw.Event, _]

    The onoffline property of the WorkerGlobalScope interface represents an EventHandler to be called when the offline event occurs and bubbles through the Worker.

    The onoffline property of the WorkerGlobalScope interface represents an EventHandler to be called when the offline event occurs and bubbles through the Worker.

    MDN

    Definition Classes
    WorkerGlobalScope
  33. val ononline: Function1[raw.Event, _]

    The ononline property of the WorkerGlobalScope interface represents an EventHandler to be called when the online event occurs and bubbles through the Worker.

    The ononline property of the WorkerGlobalScope interface represents an EventHandler to be called when the online event occurs and bubbles through the Worker.

    MDN

    Definition Classes
    WorkerGlobalScope
  34. def propertyIsEnumerable(v: String): Boolean
    Definition Classes
    Object
  35. def registration: ServiceWorkerRegistration

    The registration read-only property of the ServiceWorkerGlobalScope interface returns a reference to the ServiceWorkerRegistration object, which represents the service worker's registration.

  36. def removeEventListener[T <: raw.Event](type: String, listener: Function1[T, _], options: EventListenerOptions): Unit

    Removes the event listener previously registered with EventTarget.addEventListener.

    Removes the event listener previously registered with EventTarget.addEventListener.

    This implementation accepts a settings object of type EventListenerOptions.

    MDN

    Definition Classes
    EventTarget
  37. def removeEventListener[T <: raw.Event](type: String, listener: Function1[T, _], useCapture: Boolean = js.native): Unit

    Removes the event listener previously registered with EventTarget.addEventListener.

    Removes the event listener previously registered with EventTarget.addEventListener.

    MDN

    Definition Classes
    EventTarget
  38. def self: ServiceWorkerGlobalScope.this.type

    The self read-only property of the WorkerGlobalScope interface returns a reference to the WorkerGlobalScope itself.

    The self read-only property of the WorkerGlobalScope interface returns a reference to the WorkerGlobalScope itself. Most of the time it is a specific scope like DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, or ServiceWorkerGlobalScope.

    MDN

    Definition Classes
    WorkerGlobalScope
  39. def skipWaiting(): Promise[Unit]

    Forces the waiting service worker to become the active service worker.

    Forces the waiting service worker to become the active service worker. This method can be used with Clients.claim to ensure that updates to the underlying service worker take effect immediately for both the current client and all other active clients.

    MDN

  40. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  41. def toLocaleString(): String
    Definition Classes
    Object
  42. def toString(): String
    Definition Classes
    AnyRef → Any
  43. def valueOf(): Any
    Definition Classes
    Object
  44. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from WorkerGlobalScope

Inherited from raw.EventTarget

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped