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

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.

主站蜘蛛池模板: 博客| 宣汉县| 水富县| 金寨县| 上虞市| 松阳县| 芦溪县| 黑河市| 肃宁县| 皮山县| 资源县| 富裕县| 全州县| 汉沽区| 德阳市| 乐安县| 太谷县| 梧州市| 通州区| 焦作市| 罗平县| 巴彦淖尔市| 岫岩| 南靖县| 剑河县| 宿松县| 内江市| 宁国市| 平度市| 惠来县| 洛扎县| 丹凤县| 呼伦贝尔市| 吉隆县| 射洪县| 连城县| 承德市| 江山市| 南通市| 漠河县| 闽侯县|