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

What is a promise?

When an eventual value is returned from the completion of a single operation, it represents a promise. If we analyze promise as a pact from human, it will help us understand the concept of promises in computer programming especially from the JavaScript perspective. Every promise is a pact among two or more parties to deliver some value to the other. The value can either be tangible or intangible, but a promise must deliver something in return. Until the promise is fulfilled, it remains in an unfulfilled state. However, when the said commitment has been made, the promise is said to be fulfilled. If the promise is not delivered as anticipated, the promise is said to fail.

So, what is a promise? According to the official definition:

Promise is an object or a function with a then method whose behavior confirms to this specification and represents the eventual result of an asynchronous operation.

The source of this definition is slide number 21 at http://www.slideshare.net/wookieb/callbacks-promises-generators-asynchronous-javascript.

主站蜘蛛池模板: 云安县| 张家港市| 临汾市| 泌阳县| 札达县| 辛集市| 原平市| 泌阳县| 阳高县| 宁阳县| 冕宁县| 耒阳市| 盐山县| 宜昌市| 华阴市| 彩票| 浮梁县| 宣汉县| 台北市| 阿拉善右旗| 石屏县| 兰州市| 乌拉特后旗| 巴塘县| 门源| 米脂县| 天柱县| 甘肃省| 喜德县| 汶川县| 南靖县| 留坝县| 常宁市| 双柏县| 峨眉山市| 阿坝县| 湖口县| 海淀区| 同仁县| 松滋市| 大兴区|