- 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.
推薦閱讀
- Building a Home Security System with Raspberry Pi
- 造個小程序:與微信一起干件正經事兒
- 摩登創客:與智能手機和平板電腦共舞
- Python神經網絡項目實戰
- Mastering Julia
- Python數據挖掘與機器學習實戰
- Visual C++數字圖像處理技術詳解
- MATLAB for Machine Learning
- RabbitMQ Essentials
- OpenResty完全開發指南:構建百萬級別并發的Web應用
- Rust游戲開發實戰
- 高質量程序設計指南:C++/C語言
- Cloud Development andDeployment with CloudBees
- LiveCode Mobile Development Hotshot
- Instant SQL Server Analysis Services 2012 Cube Security