The SharedWorker interface represents a specific kind of worker that can be accessed from several browsing contexts, such as several windows, iframes or even workers. They implement an interface different than dedicated workers and have a different global scope, SharedWorkerGlobalScope.

Documentation SharedWorker by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Constructor

new(scriptURL:String, ?options:String)

new(scriptURL:String, ?options:Null<WorkerOptions>)

Throws:

null

DOMError

Variables

read onlyport:MessagePort

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

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener(type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener(type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener(type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener(type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError