Ron Buckton (2014-08-18T19:03:08.000Z)
I created the following gist as a proposal for the addition of a `finally` method to the prototype of the Promise constructor, either for ES6 (if such a thing is considered valuable and could be fast tracked at this date), or for ES7. This method would take in a single callback that would be executed once when the antecedent Promise is settled regardless of whether it was fulfilled or rejected. If the callback results in a normal completion, the state of the antecedent promise would be adopted by the new Promise. However, if the callback results in an abrupt completion, the new Promise would be rejected with this reason.



You can find more details about this proposal along with amendments to the current ES6 working draft below:



[1] https://gist.github.com/rbuckton/66918c8491aa335b003c

[https://avatars2.githubusercontent.com/u/3902892?s=140]<https://gist.github.com/rbuckton/66918c8491aa335b003c>

Proposal for addition of Promise.prototype.finally
Proposal for addition of Promise.prototype.finally - Gist is a simple way to share snippets of text and code with others.
Read more...<https://gist.github.com/rbuckton/66918c8491aa335b003c>




After working heavily with an ES6 Promise shim as of late, I have found such a feature would be very valuable. It is possible to patch the ES6 Promise API to add such a feature, however it seems like it could be a worthwhile addition that could benefit the community until such a time as an `async/await`-like syntax is available in ES7+.



Best regards,

Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140818/e70d0ff0/attachment.html>
domenic at domenicdenicola.com (2014-08-22T21:32:57.720Z)
I created the following gist as a proposal for the addition of a `finally` method to the prototype of the Promise constructor, either for ES6 (if such a thing is considered valuable and could be fast tracked at this date), or for ES7. This method would take in a single callback that would be executed once when the antecedent Promise is settled regardless of whether it was fulfilled or rejected. If the callback results in a normal completion, the state of the antecedent promise would be adopted by the new Promise. However, if the callback results in an abrupt completion, the new Promise would be rejected with this reason.



You can find more details about this proposal along with amendments to the current ES6 working draft at https://gist.github.com/rbuckton/66918c8491aa335b003c

After working heavily with an ES6 Promise shim as of late, I have found such a feature would be very valuable. It is possible to patch the ES6 Promise API to add such a feature, however it seems like it could be a worthwhile addition that could benefit the community until such a time as an `async/await`-like syntax is available in ES7+.