Skip to content

Commit

Permalink
Update state terminology on promises
Browse files Browse the repository at this point in the history
  • Loading branch information
edyionescu committed Sep 22, 2017
1 parent 1d049b7 commit 9a1366c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ When you do an *Ajax request* the response is not synchronous because you want a
To handle that kind of situations, ES2015 has given us *promises*. Promises can have three different states:

- Pending
- Resolved
- Fulfilled
- Rejected

Let's say we want to use promises to handle an Ajax request to fetch the resource X.
Expand All @@ -958,7 +958,7 @@ const xFetcherPromise = new Promise( // Create promise using "new" keyword and s
)
```

As seen in the above sample, the Promise object takes a function which takes two parameters **resolve** and **reject**. Those parameters are functions which when called are going to move the promise *pending* state to respectively a *resolved* and *rejected* state.
As seen in the above sample, the Promise object takes a function which takes two parameters **resolve** and **reject**. Those parameters are functions which when called are going to move the promise *pending* state to respectively a *fulfilled* and *rejected* state.

But at the moment, the promise has not been used but only has been declared and stored into *xFetcherPromise* variable! So it doesn't have a current state.

Expand Down

0 comments on commit 9a1366c

Please sign in to comment.