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

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

A modern runtime for JavaScript and TypeScript.
Latest
method Deno.UnsafeCallback.threadSafe
import { Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.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: Definition
callback: UnsafeCallbackFunction<Definition["parameters"], Definition["result"]>