HookCallbacks - Node documentation
interface HookCallbacks

Usage

import { type HookCallbacks } from "node:async_hooks";

Methods

optional
init(
asyncId: number
type: string
triggerAsyncId: number
resource: object
): void

Called when a class is constructed that has the possibility to emit an asynchronous event.

optional
before(asyncId: number): void

When an asynchronous operation is initiated or completes a callback is called to notify the user. The before callback is called just before said callback is executed.

optional
after(asyncId: number): void

Called immediately after the callback specified in before is completed.

optional
promiseResolve(asyncId: number): void

Called when a promise has resolve() called. This may not be in the same execution id as the promise itself.

optional
destroy(asyncId: number): void

Called after the resource corresponding to asyncId is destroyed