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

Considerations while choosing a promise

Before you start working with a promise library, there are a number of elements you should keep in mind. Not all the implementations of a promise's implementation are created equally. They are different from one another in terms of offered utilities by API, performance, and sometimes, behavior too.

A promise/proposal just outlines the proposed behavior of the promises and not implementation specifications. This results in varying libraries offering a different set of features. These are the ways that they differ from one another:

  • All promises/compliments have then(); function and also have varying features in their API. In addition to this, they're still able to exchange promises with each other.
  • In promise/compliant libraries, a thrown exception is translated into a rejection and the errorHandler() method is called with the exception.

As a result of the differing implementations, there are interoperability problems when working with libraries that return or expect promise/compliant.

There may be trade-offs in choosing a promise library. Every library has its own pros and cons, and it is purely up to you to decide what to use depending on the particular use case and your project needs.

主站蜘蛛池模板: 承德县| 汤阴县| 西青区| 淳安县| 磐安县| 大荔县| 子长县| 广丰县| 堆龙德庆县| 玉田县| 东源县| 苏州市| 阳谷县| 宜黄县| 南漳县| 安陆市| 图们市| 宣恩县| 新安县| 南丰县| 泽州县| 谢通门县| 阜城县| 志丹县| 华蓥市| 吴旗县| 荥经县| 车致| 洪雅县| 辽中县| 昌乐县| 建始县| 噶尔县| 阜新| 石泉县| 大兴区| 浮梁县| 吉木萨尔县| 冕宁县| 大田县| 铜陵市|