Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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,
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,
options?: boolean | EventListenerOptions,
): void;
}
var SharedWorker: {
prototype: SharedWorker;
new (scriptURL: string | URL, options?: string | WorkerOptions): SharedWorker;
}
;

§Extends

§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>(
type: K,
listener: (this: SharedWorker, ev: AbstractWorkerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
removeEventListener<K extends keyof AbstractWorkerEventMap>(
type: K,
listener: (this: SharedWorker, ev: AbstractWorkerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
[src]
§
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void
[src]