Update article.md
Small punctuation change. Separately, I didn't change anything on this today, but note that line 34 above: "So to summarize: the executor runs automatically and attempts to perform a job. When it is finished with the attempt it calls `resolve` if it was successful or `reject` if there was an error." was, before it was changed recently, pretty much the same as line 82 above: "To summarize, the executor should perform a job (usually something that takes time) and then call `resolve` or `reject` to change the state of the corresponding promise object." So maybe some revision there is in order -- to not have both, or to change one or both. Not familiar enough with the article at this point to make the revision.
This commit is contained in:
parent
f186b7c86f
commit
cae000f4ee
1 changed files with 1 additions and 1 deletions
|
@ -26,7 +26,7 @@ The function passed to `new Promise` is called the *executor*. When `new Promise
|
||||||
|
|
||||||
Its arguments `resolve` and `reject` are callbacks provided by JavaScript itself. Our code is only inside the executor.
|
Its arguments `resolve` and `reject` are callbacks provided by JavaScript itself. Our code is only inside the executor.
|
||||||
|
|
||||||
When the executor obtains the result, be it soon or late - doesn't matter, it should call one of these callbacks:
|
When the executor obtains the result, be it soon or late, doesn't matter, it should call one of these callbacks:
|
||||||
|
|
||||||
- `resolve(value)` — if the job finished successfully, with result `value`.
|
- `resolve(value)` — if the job finished successfully, with result `value`.
|
||||||
- `reject(error)` — if an error occurred, `error` is the error object.
|
- `reject(error)` — if an error occurred, `error` is the error object.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue