官术网_书友最值得收藏!

  • Mastering JavaScript Promises
  • Muzzamil Hussain
  • 174字
  • 2021-07-16 13:46:48

The promises object

The promises object is the last of the major concepts of asynchronous programming model implemented. We will be looking at promise as a design pattern.

Promise is a relatively new concept in JavaScript, but it's been around for a long time and has been implemented in other languages.

Promise is an abstraction that contains two main properties, which make them easier to work with:

  • You can attach more than one callback with a single promise
  • Values and states (errors) get passed along
  • Due to these properties, a promise makes common asynchronous patterns using callback easy

A promise can be defined as:

A promise is an observable token given from one object to another. Promises wrap an operation and notify their observers when the operation either succeeds or fails.

The source of this definition is Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley Professional.

Since the scope of this book revolves around the promise and how it is implemented, we will discuss it in greater detail in Chapter 3, The Promise Paradigm.

主站蜘蛛池模板: 大厂| 庆云县| 砚山县| 阜新市| 珠海市| 铜陵市| 云龙县| 昌图县| 卢氏县| 民丰县| 济南市| 黄石市| 双鸭山市| 临沂市| 临武县| 临西县| 剑阁县| 利辛县| 原阳县| 通州区| 香格里拉县| 岢岚县| 萨嘎县| 得荣县| 铜川市| 桂阳县| 灵宝市| 永善县| 平塘县| 临江市| 津南区| 綦江县| 新安县| 浮梁县| 都江堰市| 安徽省| 昌图县| 沙河市| 九江县| 黑水县| 临江市|