官术网_书友最值得收藏!

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:

  1. Every deferred object has a promise that serves as a proxy for the future result.
  2. 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.
  3. 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.
主站蜘蛛池模板: 万载县| 启东市| 高唐县| 都兰县| 苗栗县| 临清市| 厦门市| 故城县| 平舆县| 固阳县| 荔浦县| 汽车| 重庆市| 巴塘县| 米林县| 宽城| 阳原县| 克什克腾旗| 庄浪县| 郓城县| 庆云县| 阿尔山市| 伊春市| 吉木萨尔县| 图木舒克市| 东城区| 高唐县| 大埔区| 荆州市| 黔南| 阜康市| 五河县| 兴海县| 天长市| 渭源县| 霍山县| 莫力| 桓仁| 无锡市| 沭阳县| 阳山县|