Worker

class Worker extends EventTarget {
constructor(specifier: string | URL, options?: WorkerOptions);
onerror?: (e: ErrorEvent) => void;
onmessage?: (e: MessageEvent) => void;
onmessageerror?: (e: MessageEvent) => void;
 
addEventListener<K extends keyof WorkerEventMap>(
type: K,
listener: (this: Worker, ev: WorkerEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void;
postMessage(message: any, transfer: Transferable[]): void;
postMessage(message: any, options?: StructuredSerializeOptions): void;
removeEventListener<K extends keyof WorkerEventMap>(
type: K,
listener: (this: Worker, ev: WorkerEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void;
terminate(): void;
}

§Extends

§
EventTarget
[src]

§Constructors

§
new Worker(specifier: string | URL, options?: WorkerOptions)
[src]

§Properties

§
onerror: (e: ErrorEvent) => void
[src]
§
onmessage: (e: MessageEvent) => void
[src]
§
onmessageerror: (e: MessageEvent) => void
[src]

§Methods

§
addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void
[src]
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void
[src]
§
postMessage(message: any, transfer: Transferable[]): void
[src]
postMessage(message: any, options?: StructuredSerializeOptions): void
[src]
§
removeEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void
[src]
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void
[src]
§
terminate(): void
[src]