Optional
opts: WorkerOptions & { The actual worker that is used, depending on browser support it can be either a SharedWorker
or a normal Worker
.
Is an EventListener that is called whenever an ErrorEvent of type error event occurs.
An EventListener called when MessageEvent of type message is fired on the port—that is, when the port receives a message.
An EventListener called when a MessageEvent of type MessageError is fired—that is, when it receives a message that cannot be deserialized.
Returns a MessagePort object used to communicate with and control the shared worker.
Registers an event handler of a specific event type on the EventTarget
Optional
options: boolean | AddEventListenerOptionsRemoves an event listener from the EventTarget.
Optional
options: boolean | EventListenerOptions
A polyfill class for
SharedWorker
, it accepts a URL/string as well as any other options the spec. allows forSharedWorker
. It supports all the same methods and properties as the original, except it adds compatibility methods and properties for older browsers that don't supportSharedWorker
, so, it can switch to normalWorkers
instead.