Options
All
  • Public
  • Public/Protected
  • All
Menu

A polyfill class for SharedWorker, it accepts a URL/string as well as any other options the spec. allows for SharedWorker. It supports all the same methods and properties as the original, except it adds compatibility methods and properties for older browsers that don't support SharedWorker, so, it can switch to normal Workers instead.

Hierarchy

  • SharedWorkerPolyfill

Implements

Index

Constructors

Properties

The actual worker that is used, depending on browser support it can be either a SharedWorker or a normal Worker.

Accessors

  • An EventListener called when MessageEvent of type message is fired on the port—that is, when the port receives a message.

    Returns ((this: External.MessagePort, ev: MessageEvent<any>) => any) | ((this: External.Worker, ev: MessageEvent<any>) => any)

  • An EventListener called when MessageEvent of type message is fired on the port—that is, when the port receives a message.

    Parameters

    Returns void

  • An EventListener called when a MessageEvent of type MessageError is fired—that is, when it receives a message that cannot be deserialized.

    Returns ((this: External.MessagePort, ev: MessageEvent<any>) => any) | ((this: External.Worker, ev: MessageEvent<any>) => any)

  • An EventListener called when a MessageEvent of type MessageError is fired—that is, when it receives a message that cannot be deserialized.

    Parameters

    Returns void

  • Returns a MessagePort object used to communicate with and control the shared worker.

    Returns External.MessagePort

Methods

  • close(): void
  • Disconnects the port, so it is no longer active.

    Returns void

  • Dispatches an event to this EventTarget.

    Parameters

    Returns boolean

  • Clones message and transmits it to worker's global environment. transfer can be passed as a list of objects that are to be transferred rather than cloned.

    Parameters

    Returns void

  • start(): void
  • Starts the sending of messages queued on the port (only needed when using EventTarget.addEventListener; it is implied when using MessagePort.onmessage.)

    Returns void

  • terminate(): void
  • Immediately terminates the worker. This does not let worker finish its operations; it is halted at once. ServiceWorker instances do not support this method.

    Returns void

Generated using TypeDoc