JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1891909
  • Score
    100M100P100Q247192F

A polyfill for Promise.prototype.finally for ES6 compliant promises

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 Codeship Status for matthew-andrews/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:-

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 with unwitting help and support from Stefan Penner. 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.