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

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.

主站蜘蛛池模板: 比如县| 泉州市| 堆龙德庆县| 仙游县| 同江市| 广饶县| 长治市| 南木林县| 黄龙县| 双柏县| 黑龙江省| 北京市| 漯河市| 海城市| 博野县| 仁化县| 乌兰浩特市| 武清区| 秭归县| 融水| 沾化县| 临沭县| 康定县| 威宁| 河间市| 婺源县| 吴堡县| 鹤庆县| 曲水县| 延川县| 郓城县| 信阳市| 衡东县| 县级市| 吐鲁番市| 五大连池市| 高青县| 汪清县| 长阳| 徐水县| 乌兰察布市|