This commit is contained in:
Ilya Kantor 2019-09-02 21:48:45 +03:00
parent c6b8c2595d
commit 2f9221f4d3

View file

@ -24,7 +24,7 @@ let promise = new Promise(function(resolve, reject) {
The function passed to `new Promise` is called the *executor*. When `new Promise` is created, it runs automatically. It contains the producing code, that should eventually produce a result. In terms of the analogy above: the executor is the "singer". The function passed to `new Promise` is called the *executor*. When `new Promise` is created, it runs automatically. It contains the producing code, that should eventually produce a result. In terms of the analogy above: the executor is the "singer".
Its arguments `resolve` and `reject` are callbacks provided by JavaScript itself. Our code is only inside 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: