const delay = (time) => {
if (typeof time !== "number") return;
return new Promise((resolve) => {
setTimeout(resolve, time);
});
};
const delay = (time) => {
if (typeof time !== "number") return;
return new Promise((resolve) => {
setTimeout(resolve, time);
});
};
本文标题:利用 Promise 写一个 delay 等待函数
本文链接:https://www.haomeiwen.com/subject/bxvzgktx.html
网友评论