- Mastering JavaScript Promises
- Muzzamil Hussain
- 193字
- 2021-07-16 13:46:51
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.
- HTML5+CSS3王者歸來(lái)
- Mastering Entity Framework Core 2.0
- PHP+MySQL網(wǎng)站開(kāi)發(fā)技術(shù)項(xiàng)目式教程(第2版)
- C語(yǔ)言最佳實(shí)踐
- PhoneGap:Beginner's Guide(Third Edition)
- 深度學(xué)習(xí):Java語(yǔ)言實(shí)現(xiàn)
- Python+Tableau數(shù)據(jù)可視化之美
- Getting Started with Nano Server
- Arduino可穿戴設(shè)備開(kāi)發(fā)
- C陷阱與缺陷
- 從零開(kāi)始構(gòu)建深度前饋神經(jīng)網(wǎng)絡(luò):Python+TensorFlow 2.x
- 美麗洞察力:從化妝品行業(yè)看顧客需求洞察
- JavaScript全棧開(kāi)發(fā)
- Web應(yīng)用程序開(kāi)發(fā)技術(shù)
- 區(qū)塊鏈社會(huì):區(qū)塊鏈助力國(guó)家治理能力現(xiàn)代化