Skip to main content
Deno.UnsafeCallback.threadSafe - Deno documentation
method Deno.UnsafeCallback.threadSafe
UnsafeCallback.threadSafe<Definition extends UnsafeCallbackDefinition = UnsafeCallbackDefinition>(
definition: Definition,
callback: UnsafeCallbackFunction<Definition["parameters"], Definition["result"]>,
): UnsafeCallback<Definition>

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.

Type Parameters

Parameters

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

Return Type

Back to top