Glossary Term
Promise() constructor
The Promise() constructor creates Promise objects. It is primarily used to wrap callback-based APIs that do not already support promises.
Traditionally (before promises), asynchronous tasks were designed as callbacks.
To take advantage of the readability improvement and language features offered by promises, the Promise() constructor allows one to transform the callback-based API to a promise-based one.
Note: If your task is already promise-based, you likely do not need the Promise() constructor.
The executor is custom code that ties an outcome in a callback to a promise. You, the programmer, write the executor. Its signature is expected to be:
Syntax example: new Promise(executor)
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
