nodeAsyncHooksMod

class Object
trait Matchable
class Any

Type members

Classlikes

@JSImport("node:async_hooks", "AsyncLocalStorage") @native @JSType
class AsyncLocalStorage[T]() extends AsyncLocalStorage[T]

When having multiple instances of AsyncLocalStorage, they are independent from each other. It is safe to instantiate this class multiple times.

When having multiple instances of AsyncLocalStorage, they are independent from each other. It is safe to instantiate this class multiple times.

@JSImport("node:async_hooks", "AsyncResource") @native @JSType

The class AsyncResource was designed to be extended by the embedder's async resources. Using this users can easily trigger the lifetime events of their own resources.

The class AsyncResource was designed to be extended by the embedder's async resources. Using this users can easily trigger the lifetime events of their own resources.

Companion
object
Companion
class

Value members

Concrete methods

@inline

Registers functions to be called for different lifetime events of each async operation.

Registers functions to be called for different lifetime events of each async operation.

Value Params
options

the callbacks to register

Returns

an AsyncHooks instance used for disabling and enabling hooks

@inline
def executionAsyncId(): Double

Returns the asyncId of the current execution context.

Returns the asyncId of the current execution context.

@inline
def executionAsyncResource(): Object

The resource representing the current execution. Useful to store data within the resource.

The resource representing the current execution. Useful to store data within the resource.

Resource objects returned by executionAsyncResource() are most often internal Node.js handle objects with undocumented APIs. Using any functions or properties on the object is likely to crash your application and should be avoided.

Using executionAsyncResource() in the top-level execution context will return an empty object as there is no handle or request object to use, but having an object representing the top-level can be helpful.

@inline
def triggerAsyncId(): Double

Returns the ID of the resource responsible for calling the callback that is currently being executed.

Returns the ID of the resource responsible for calling the callback that is currently being executed.

Concrete fields

@JSImport("node:async_hooks") @native
val ^: Any