Package Exports
- promise.prototype.finally
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promise.prototype.finally) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Promise.prototype.finally 
A polyfill for Promise.prototype.finally
. See docs on what finally is on your favourite pre-ES6 promise library.
Warning: This micro-library doesn't force you to use any particular Promise implementation by using whatever Promise
has been defined as globally. This is so that you may use any ES6 standard Promise compliant library - or, of course, native ES6 Promises.
If you're running the code on a browser or node version that doesn't include native promises you will need to include a polyfill. The following polyfills are tested as part of this module's test suite:-
- Jake Archibald's ES6 Promise library (which is actually adapted from Stefan Penner's RSVP.js). -
require('es6-promise').polyfill();
Installation
npm install promise.prototype.finally --save
Examples
require('es6-promise').polyfill();
require('promise.prototype.finally');
Promise.resolve(6)
.finally(function() {
console.log('this will always be called');
});
Promise.reject(6)
.finally(function() {
console.log('this will always be called');
});
Credits and collaboration
The lead developer of Promise.prototype.finally is Matt Andrews at FT, the code is based on a snippet by Stefan Penner - used with permission. All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.