Skip to content

Instantly share code, notes, and snippets.

View kagaya85's full-sized avatar
🎯
Focusing

Kagaya kagaya85

🎯
Focusing
View GitHub Profile
@kagaya85
kagaya85 / Promise.js
Last active May 9, 2019 18:42
将旧API封装成Promise对象的方法
// 已setTimeout为例
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
// 调用
wait(1000).then(() => {
// do something
});
// 这样回调起来就舒服多了