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