跳到主要内容

nextMicroTask()

function nextMicroTask<T, R>(fn?): Promise<void | R>;

Defined in: async/nextMicroTask.ts:11

将函数推迟到下一个微任务队列执行

Type Parameters

Type ParameterDefault typeDescription
Tvoid回调函数中 this 的类型
Rvoid回调函数的返回值类型

Parameters

ParameterTypeDescription
fn?(this) => R要推迟执行的函数,可选

Returns

Promise<void | R>

解析为回调结果的 Promise;未传回调时在下一微任务解析