- 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.
推薦閱讀
- Expert C++
- C# 2012程序設計實踐教程 (清華電腦學堂)
- Git高手之路
- Learning Python Design Patterns(Second Edition)
- 飛槳PaddlePaddle深度學習實戰
- Gradle for Android
- Visual Basic程序設計習題與上機實踐
- ArcGIS for Desktop Cookbook
- Geospatial Development By Example with Python
- Learning AWS
- CodeIgniter Web Application Blueprints
- Hands-On Robotics Programming with C++
- 奔跑吧 Linux內核
- Python Linux系統管理與自動化運維
- PHP典型模塊與項目實戰大全