diff --git a/source/_posts/异步执行.md b/source/_posts/异步执行.md index 2bd00b4..54898db 100644 --- a/source/_posts/异步执行.md +++ b/source/_posts/异步执行.md @@ -94,4 +94,13 @@ verifyPizza(); eatPizza(); // twiddle thumbs payForPizza(); +``` +# 定时间 +```javascript +function orderExecutor(resolve, reject) { // reject not required here + console.log('making our pizza...'); + setTimeout(resolve, 5000); +} +let orderPizza = new Promise(orderExecutor); +orderPizza.then(function () { console.log('eating pizza!'); }); ``` \ No newline at end of file