Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Methods

asyncId

  • asyncId(): number
  • Returns number

    the unique ID assigned to this AsyncResource instance.

bind

  • bind<Func>(fn: Func): Func & object
  • Binds the given function to execute to this AsyncResource's scope.

    Type parameters

    • Func: function

    Parameters

    • fn: Func

      The function to bind to the current AsyncResource.

    Returns Func & object

disconnect

  • disconnect(): void
  • Disconnects the PerformanceObserver instance from all notifications.

    Returns void

emitDestroy

  • emitDestroy(): void
  • Call AsyncHooks destroy callbacks.

    Returns void

observe

  • observe(options: object): void
  • Subscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified by options.entryTypes. When options.buffered is false, the callback will be invoked once for every PerformanceEntry instance. Property buffered defaults to false.

    Parameters

    • options: object
      • Optional buffered?: boolean
      • entryTypes: ReadonlyArray<EntryType>

    Returns void

runInAsyncScope

  • runInAsyncScope<This, Result>(fn: function, thisArg?: This, ...args: any[]): Result
  • Call the provided function with the provided arguments in the execution context of the async resource. This will establish the context, trigger the AsyncHooks before callbacks, call the function, trigger the AsyncHooks after callbacks, and then restore the original execution context.

    Type parameters

    • This

    • Result

    Parameters

    • fn: function

      The function to call in the execution context of this async resource.

        • (this: This, ...args: any[]): Result
        • Parameters

          • this: This
          • Rest ...args: any[]

          Returns Result

    • Optional thisArg: This

      The receiver to be used for the function call.

    • Rest ...args: any[]

      Optional arguments to pass to the function.

    Returns Result

triggerAsyncId

  • triggerAsyncId(): number
  • Returns number

    the trigger ID for this AsyncResource instance.

Static bind

  • bind<Func>(fn: Func, type?: string): Func & object
  • Binds the given function to the current execution context.

    Type parameters

    • Func: function

    Parameters

    • fn: Func

      The function to bind to the current execution context.

    • Optional type: string

      An optional name to associate with the underlying AsyncResource.

    Returns Func & object

Generated using TypeDoc