SharedWorker
interface SharedWorker extends EventTarget, AbstractWorker {
readonly port: MessagePort;
addEventListener<K extends keyof AbstractWorkerEventMap>(
type: K,
listener: (this: SharedWorker, ev: AbstractWorkerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;removeEventListener<K extends keyof AbstractWorkerEventMap>(
type: K,
listener: (this: SharedWorker, ev: AbstractWorkerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;removeEventListener(
}type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;var SharedWorker: {
prototype: SharedWorker;
new (scriptURL: string | URL, options?: string | WorkerOptions): SharedWorker;
};§Properties
§
readonly port: MessagePort
[src]Returns sharedWorker's MessagePort object which can be used to communicate with the global environment.
§Methods
§
addEventListener<K extends keyof AbstractWorkerEventMap>(
[src]type: K,
listener: (this: SharedWorker, ev: AbstractWorkerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void§
addEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void§
removeEventListener<K extends keyof AbstractWorkerEventMap>(
[src]type: K,
listener: (this: SharedWorker, ev: AbstractWorkerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void§
removeEventListener(
[src]type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void