- 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.
推薦閱讀
- 計算思維與算法入門
- 潮流:UI設(shè)計必修課
- SQL Server 2016從入門到精通(視頻教學(xué)超值版)
- Building a Home Security System with Raspberry Pi
- 程序員面試筆試寶典
- 深入淺出Spring Boot 2.x
- HTML5+CSS3基礎(chǔ)開發(fā)教程(第2版)
- R語言編程指南
- 精通網(wǎng)絡(luò)視頻核心開發(fā)技術(shù)
- Access 2016數(shù)據(jù)庫管
- Practical Game Design with Unity and Playmaker
- Backbone.js Testing
- Visual Basic語言程序設(shè)計基礎(chǔ)(第3版)
- Java EE架構(gòu)設(shè)計與開發(fā)實(shí)踐
- Java多線程并發(fā)體系實(shí)戰(zhàn)(微課視頻版)