new events.EventEmitterAsyncResource([options])


  • options <Object>
    • captureRejections <boolean> 启用自动捕获 promise 拒绝默认值: false
    • name <string> 异步事件的类型。 默认值:: new.target.name
    • triggerAsyncId <number> 创建此异步事件的执行上下文的 ID。 默认值: executionAsyncId()
    • requireManualDestroy <boolean> 如果设置为 true,则当对象被垃圾回收时禁用 emitDestroy。 这通常不需要设置(即使手动调用 emitDestroy),除非检索到资源的 asyncId 并调用敏感 API 的 emitDestroy。 当设置为 false 时,则只有在至少有一个活动的 destroy 钩子时才会调用 emitDestroy 垃圾回收。 默认值: false
  • options <Object>
    • captureRejections <boolean> It enables automatic capturing of promise rejection. Default: false.
    • name <string> The type of async event. Default:: new.target.name.
    • triggerAsyncId <number> The ID of the execution context that created this async event. Default: executionAsyncId().
    • requireManualDestroy <boolean> If set to true, disables emitDestroy when the object is garbage collected. This usually does not need to be set (even if emitDestroy is called manually), unless the resource's asyncId is retrieved and the sensitive API's emitDestroy is called with it. When set to false, the emitDestroy call on garbage collection will only take place if there is at least one active destroy hook. Default: false.