doc: add still asynchronous section
This commit is contained in:
1 parent
072ccf42c9
commit
c29b722e89
1 file changed
+12
@@ -212,3 +212,15 @@ function eat() {
|
|||||||
let orderPizza = new Promise(orderExecutor);
|
let orderPizza = new Promise(orderExecutor);
|
||||||
orderPizza.then(eat).then(function () { console.log('Paying the bill!'); });
|
orderPizza.then(eat).then(function () { console.log('Paying the bill!'); });
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# 还是异步
|
||||||
|
```javascript
|
||||||
|
function orderExecutor(resolve, reject) {
|
||||||
|
console.log('Pizza ordered...');
|
||||||
|
resolve("Here's your pizza!");
|
||||||
|
}
|
||||||
|
|
||||||
|
let orderPizza = new Promise(orderExecutor);
|
||||||
|
orderPizza.then(function (value) { console.log(value); });
|
||||||
|
console.log("Waiting for my pizza!");
|
||||||
|
```
|
||||||
Reference in new issue
Block a user