- 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.
- Web程序設(shè)計(jì)及應(yīng)用
- Redis Applied Design Patterns
- 編程卓越之道(卷3):軟件工程化
- MySQL 8 DBA基礎(chǔ)教程
- Python測(cè)試開發(fā)入門與實(shí)踐
- Django Design Patterns and Best Practices
- 深度強(qiáng)化學(xué)習(xí)算法與實(shí)踐:基于PyTorch的實(shí)現(xiàn)
- 青少年P(guān)ython編程入門
- Regression Analysis with Python
- R語(yǔ)言:邁向大數(shù)據(jù)之路(加強(qiáng)版)
- C++從入門到精通(第6版)
- Penetration Testing with the Bash shell
- DevOps 精要:業(yè)務(wù)視角
- Java EE基礎(chǔ)實(shí)用教程
- micro:bit軟件指南