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

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.

主站蜘蛛池模板: 婺源县| 中阳县| 武邑县| 南汇区| 平谷区| 会昌县| 永新县| 商城县| 鄢陵县| 辰溪县| 宝鸡市| 旬阳县| 沙湾县| 察雅县| 包头市| 阿巴嘎旗| 汉沽区| 法库县| 谷城县| 屏东市| 丹寨县| 旅游| 湖口县| 云安县| 颍上县| 鹤峰县| 大洼县| 大连市| 嵊泗县| 原阳县| 永靖县| 镇江市| 镇坪县| 合阳县| 湖州市| 盐池县| 蛟河市| 汕尾市| 淮北市| 大宁县| 竹溪县|