- Mastering JavaScript Promises
- Muzzamil Hussain
- 120字
- 2021-07-16 13:46:49
How do promise and deferred relate to each other?
So far, in Chapter 2, The JavaScript Asynchronous Model, we discussed promises and how they work. Let's have a look at how promises and deferred work:
- Every deferred object has a promise that serves as a proxy for the future result.
- A deferred object can be resolved or rejected by its caller, which separates the promise from the resolver, while a promise is a value returned by an asynchronous function.
- The promise can be given to a number of consumers and each will observe the resolution incessantly, while the resolver/deferred can be given to any number of users and the promise will be resolved by the one that first resolved it.
推薦閱讀
- 自己動手寫搜索引擎
- Docker技術入門與實戰(第3版)
- Developing Middleware in Java EE 8
- Mastering Kotlin
- MySQL數據庫管理與開發實踐教程 (清華電腦學堂)
- Android Native Development Kit Cookbook
- Deep Learning with R Cookbook
- Android Development Tools for Eclipse
- DB2SQL性能調優秘笈
- Python機器學習開發實戰
- Node.js 6.x Blueprints
- Software Architecture with Python
- Python程序設計:基礎與實踐
- SQL Server 2014數據庫設計與開發教程(微課版)
- Python深度學習入門:從零構建CNN和RNN