通过匿名的async方法
// let timer;
// // clearTimeout(计时器);
// timer = setTimeout(() => {
// (async () => {
// await this._doSomething();
// })();
// }, 2000);
可以尝试 es7 sleep
另外也可以使用 async IIFE 表达式,比如
// IIFE 函数表达式
(async function() {
// todo main process
})();
// IIFE Lambda 表达式(箭头函数表达式)
(async () => {
// todo main process
})();
参考贴 https://www.it1352.com/1009501.html
参考贴 https://blog.youkuaiyun.com/MFWSCQ/article/details/105109727
参考贴 https://cloud.tencent.com/developer/ask/171603
参考贴 https://blog.youkuaiyun.com/weixin_34166472/article/details/88198854
参考贴 https://es6.ruanyifeng.com/#docs/async