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
interface Worker
implements EventTarget
import { type Worker } from "https://deno.land/x/deno@v1.36.0/cli/tsc/dts/lib.deno.shared_globals.d.ts";

Properties

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

Methods

postMessage(message: any, transfer: Transferable[]): void
postMessage(message: any, options?: StructuredSerializeOptions): 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
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
variable Worker
import { Worker } from "https://deno.land/x/deno@v1.36.0/cli/tsc/dts/lib.deno.shared_globals.d.ts";

type

{ readonly prototype: Worker; new (specifier: string | URL, options?: WorkerOptions): Worker; }