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

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.
主站蜘蛛池模板: 塔河县| 松原市| 同江市| 上栗县| 陈巴尔虎旗| 马龙县| 开阳县| 临桂县| 晋宁县| 黄平县| 项城市| 天水市| 南安市| 资兴市| 台东市| 辽阳县| 新建县| 明光市| 灵山县| 三都| 平阳县| 日照市| 曲靖市| 新营市| 镇坪县| 龙陵县| 涟源市| 高要市| 武定县| 洛隆县| 潍坊市| 五莲县| 五大连池市| 竹山县| 建昌县| 台东县| 浦北县| 安溪县| 奇台县| 筠连县| 五河县|