Promise 形式的等待,与 wait 不一样的是,它等待的单位是秒。
wait
秒数
0.0.7
(async () => { console.log(1); // 输出 1 await waitForSeconds(1.5); // 等待 1.5 秒 console.log(2); // 输出 2})(); Copy
(async () => { console.log(1); // 输出 1 await waitForSeconds(1.5); // 等待 1.5 秒 console.log(2); // 输出 2})();
Promise 形式的等待,与
wait不一样的是,它等待的单位是秒。