Skip to main content
Worker.prototype.on - worker_threads - Node documentation
method Worker.prototype.on

Usage in Deno

import { Worker } from "node:worker_threads";
Worker.prototype.on(
event: "error",
listener: (err: Error) => void,
): this

Parameters

event: "error"
listener: (err: Error) => void

Return Type

this
Worker.prototype.on(
event: "exit",
listener: (exitCode: number) => void,
): this

Parameters

event: "exit"
listener: (exitCode: number) => void

Return Type

this
Worker.prototype.on(
event: "message",
listener: (value: any) => void,
): this

Parameters

event: "message"
listener: (value: any) => void

Return Type

this
Worker.prototype.on(
event: "messageerror",
listener: (error: Error) => void,
): this

Parameters

event: "messageerror"
listener: (error: Error) => void

Return Type

this
Worker.prototype.on(
event: "online",
listener: () => void,
): this

Parameters

event: "online"
listener: () => void

Return Type

this
Worker.prototype.on(
event: string | symbol,
listener: (...args: any[]) => void,
): this

Parameters

event: string | symbol
listener: (...args: any[]) => void

Return Type

this
Back to top