asyncResource.runInAsyncScope(fn[, thisArg, ...args])
-
fn
<Function> 在此异步资源的执行上下文中调用的函数。¥
fn
<Function> The function to call in the execution context of this async resource. -
thisArg
<any> 用于函数调用的接收器。¥
thisArg
<any> The receiver to be used for the function call. -
...args
<any> 传递给函数的可选参数。¥
...args
<any> Optional arguments to pass to the function.
在异步资源的执行上下文中使用提供的参数调用提供的函数。这将建立上下文,在回调前触发 AsyncHooks,调用函数,在回调后触发 AsyncHooks,然后恢复原来的执行上下文。
¥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.