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

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.

主站蜘蛛池模板: 白沙| 健康| 巩义市| 中西区| 涪陵区| 玛纳斯县| 木里| 衡水市| 石屏县| 麻江县| 罗甸县| 临海市| 略阳县| 阳谷县| 舒城县| 安徽省| 招远市| 湖州市| 安徽省| 闽侯县| 灵台县| 许昌县| 青冈县| 金川县| 宝鸡市| 岑溪市| 九台市| 竹溪县| 太仆寺旗| 廊坊市| 黔江区| 达州市| 土默特左旗| 黄山市| 滨州市| 开鲁县| 报价| 房产| 吴桥县| 长兴县| 河西区|