Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.unstable.d.ts>Deno.UnsafeCallback.threadSafe

A modern runtime for JavaScript and TypeScript.
Go to Latest
method Deno.UnsafeCallback.threadSafe
import { Deno } from "https://deno.land/x/deno@v1.40.5/cli/tsc/dts/lib.deno.unstable.d.ts";
const { UnsafeCallback } = Deno;

Creates an UnsafeCallback and calls ref() once to allow it to wake up the Deno event loop when called from foreign threads.

This also stops Deno's process from exiting while the callback still exists and is not unref'ed.

Parameters

definition: Const<Definition>
callback: UnsafeCallbackFunction<Definition["parameters"], Definition["result"]>