Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 2x 9x 9x 2x | /**
* 延迟指定时间
* @method delay
* @param {Number} time 延迟时间(ms)
* @return {Promise<void>} 时间结束后的回调 Promise
* @example
* import { delay } from '@spore-ui/tskit';
* const fn = async () {
* await delay(100);
* console.info('100ms 后执行');
* };
* fn();
*/
export function delay(time: number): Promise<void> {
return new Promise((resolve: Function) => {
setTimeout(resolve, time);
});
}
export default delay;
|