promiseHooks.onAfter(after)
after
<Function> promise 继续执行后要调用的after
回调。- 返回: <Function> 调用以停止钩子。
after
钩子必须是普通函数。 提供异步函数会抛出异常,因为它会产生无限微任务循环。
import { promiseHooks } from 'node:v8';
const stop = promiseHooks.onAfter((promise) => {});
const { promiseHooks } = require('node:v8');
const stop = promiseHooks.onAfter((promise) => {});
after
<Function> Theafter
callback to call after a promise continuation executes.- Returns: <Function> Call to stop the hook.
The after
hook must be a plain function. Providing an async function will
throw as it would produce an infinite microtask loop.
import { promiseHooks } from 'node:v8';
const stop = promiseHooks.onAfter((promise) => {});
const { promiseHooks } = require('node:v8');
const stop = promiseHooks.onAfter((promise) => {});