Preconfigured Promise ponyfill based on promise-polyfill and setasap

Usage no npm install needed!

<script type="module">
  import promisePonyfill from '';



All reasonably modern platforms support native Promises, so this library is obsolete. Use the native Promise API instead.


Preconfigured Promise ponyfill based on promise-polyfill and setasap.

A ponyfill is like a polyfill, but it does not alter the global namespace.


This ponyfill is based on promise-polyfill. Out of the box promise-polyfill implements Promise using setImmediate if available, and otherwise it falls back to setTimeout.

This leads to a significant performance degradation on platforms where neither Promise nor setImmediate are available natively. For optimal performance on these platforms it is necessary to configure promise-polyfill to use a setImmediate polyfill such as setasap.

This module preconfigures promise-polyfill to use setasap so you don't have to think about it. Just import this module and use it like a regular Promise.

Installation and usage

npm install --save promise-ponyfill
import Promise from "promise-ponyfill";

const promise = new Promise((resolve, reject) =>
                            setTimeout(resolve, 1000));

promise.then(value => console.log("Promise resolved."))
    .catch(reason => console.error("Promise rejected", reason));

If the platform provides a native implementation of Promise, then this module will simply return the native implementation.

This is a wilful violation of the usual philosophy of ponyfills, which advocate returning the polyfill implementation in all cases. I believe that this is the best choice in this case because native Promise provides better error reporting, and I am not aware of any platforms that provide a bad native Promise implementation. If you are aware of any please let me know by raising an issue.


See for copyright and licensing information pertaining to this module.

promise-polyfill and setasap have their own separate copyright and licensing terms. See the documentation for those modules.