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

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.
主站蜘蛛池模板: 杭锦后旗| 襄垣县| 台江县| 五大连池市| 玉山县| 莱西市| 江城| 泸西县| 望谟县| 平顶山市| 南平市| 绥滨县| 盈江县| 海林市| 琼结县| 桑植县| 招远市| 塔城市| 望谟县| 鲁山县| 华坪县| 怀安县| 博爱县| 渝中区| 石柱| 双鸭山市| 旬阳县| 湖州市| 曲松县| 沁水县| 大城县| 东宁县| 双城市| 齐齐哈尔市| 奎屯市| 从江县| 钦州市| 孟州市| 灌云县| 通河县| 新晃|