t-comm
Version:
专业、稳定、纯粹的工具库
18 lines (17 loc) • 459 B
TypeScript
/**
* 延迟执行函数,等待下一个渲染帧
* 使用 setTimeout 延迟 33ms(约一帧的时间),返回 Promise
* @returns {Promise<number>} - 返回 Promise,resolve 值为 1
* @example
* ```ts
* // 等待下一帧执行
* await nextTick();
* console.log('下一帧执行');
*
* // 或使用 then
* nextTick().then(() => {
* console.log('下一帧执行');
* });
* ```
*/
export declare const nextTick: () => Promise<unknown>;