Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

es-promise

allex232MIT1.0.3

Promise implementation of Promises/A+, and with es7 promise enhancements.

promise, polyfill, Promises.try, Promise.prototype.finally

readme

Promise

A promise implementation of Promises/A+, and with es7 promise enhancements.

Author: Allex Wang (allex.wxn@gmail.com)

Note:

  • Support Promise.try(), #.finally()
  • Provide Promise.polyfill() api and entry dist/promise.polyfill.min.js

Installation

npm i es-promise

Auto-polyfill

To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet:

require('es-promise').polyfill();

Alternatively

require('es-promise/dist/promise.polyfill');

Notice that we don't assign the result of polyfill() to any variable. The polyfill() method will patch the global environment (in this case to the Promise name) when called.

License

MIT