Skip to main content
AsyncResource.bind - async_hooks - Node documentation
method AsyncResource.bind

Usage in Deno

import { AsyncResource } from "node:async_hooks";
AsyncResource.bind<
Func extends (
this: ThisArg,
...args: any[],
) => any
,
ThisArg,
>
(
fn: Func,
type?: string,
thisArg?: ThisArg,
): Func

Binds the given function to the current execution context.

Type Parameters

Func extends (
this: ThisArg,
...args: any[],
) => any
ThisArg

Parameters

fn: Func

The function to bind to the current execution context.

optional
type: string

An optional name to associate with the underlying AsyncResource.

optional
thisArg: ThisArg

Return Type