W3cubDocs

/Deno

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

Constructors

new Worker(specifier: string | URL, options?: WorkerOptions)

Properties

onerror: (e: ErrorEvent) => void
onmessage: (e: MessageEvent) => void
onmessageerror: (e: MessageEvent) => void

Methods

addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void
addEventListener(type: string, listener: EventListenerOrEventListenerObject, 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, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void
terminate(): void

© 2018–2021 the Deno authors
https://doc.deno.land/deno/stable/~/Worker