Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.shared_globals.d.ts>Worker

A modern runtime for JavaScript and TypeScript.
Go to Latest
class Worker
extends EventTarget
import { Worker } from "https://deno.land/x/deno@v1.32.3/cli/tsc/dts/lib.deno.shared_globals.d.ts";

Constructors

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

Properties

optional
onerror: (e: ErrorEvent) => void
optional
onmessage: (e: MessageEvent) => void
optional
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,
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