closes #1689
This commit is contained in:
parent
e14dcd3e16
commit
461ea30b8c
1 changed files with 4 additions and 0 deletions
|
@ -272,6 +272,10 @@ let promise = new Promise(resolve => resolve("done!"));
|
||||||
|
|
||||||
promise.then(alert); // done! (shows up right now)
|
promise.then(alert); // done! (shows up right now)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that this is different, and more powerful than the real life "subscription list" scenario. If the singer has already released their song and then a person signs up on the subscription list, they probably won't receive that song. Subscriptions in real life must be done prior to the event.
|
||||||
|
|
||||||
|
Promises are more flexible. We can add handlers any time: if the result is already there, our handlers get it immediately.
|
||||||
````
|
````
|
||||||
|
|
||||||
Next, let's see more practical examples of how promises can help us write asynchronous code.
|
Next, let's see more practical examples of how promises can help us write asynchronous code.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue