Standard behaviors of the Promise API

There are few standards as per a promise/proposal, which has to be fulfilled for the true implementation of the concept. These standards are the keys to implement promises, and any library/language must comply with it for true implementation.

A promise does the following:

  • A promise returns an eventual value when a single completion of an operation occurs.
  • A promise has three states: unfulfilled (when a promise is waiting to be processed), fulfilled (when a promise has been completed and the desired result has been obtained), and finally, failed (when the result of a promise was obtained but not as anticipated).
  • Promise has a then property, which must be a function and must return a promise. In order to complete ...

Get Mastering JavaScript Promises now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.