@diyaner/ding
Version:
dingiyan常用ts/js工具
30 lines • 685 B
JavaScript
;
/*
* @copyright: Huang Ding
* @Author: ding-cx
* @Date: 2021-03-26 17:22:13
* @LastEditors: ding-cx
* @LastEditTime: 2021-03-27 09:12:40
* @Description: file content
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.sleep = void 0;
/**
* 延时器,基于promise
* @params time 毫秒数
*/
const sleep = (time) => {
return new Promise((resolve, reject) => {
if (typeof time !== "number") {
reject();
}
else {
setTimeout(() => {
resolve(true);
}, time);
}
});
};
exports.sleep = sleep;
exports.default = sleep;
//# sourceMappingURL=sleep.js.map