Skip to content
A ponyfill/polyfill for browser Promise unhandledrejection events
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
test More robust tests Aug 9, 2017
.gitignore Initial implementation Apr 12, 2017
.npmignore Add npmignore Apr 12, 2017
.travis.yml Reorganize module and update tests Aug 9, 2017
.zuul.yml Change sauce labs browser order Aug 9, 2017
LICENSE [ci-skip] Update README with examples Apr 12, 2017
package.json 1.0.2 Mar 29, 2018
rollup.config.js Initial implementation Apr 12, 2017
rollup.config.test.js Initial implementation Apr 12, 2017


build status dependencies status npm version

A ponyfill/polyfill for browser Promise unhandledrejection events.


sauce labs test status


npm i browser-unhandled-rejection


yarn add browser-unhandled-rejection


Automatic polyfill

This automatically applies the polyfill to the global Promise object if it is needed.

import {auto} from 'browser-unhandled-rejection';

auto(); // Applies polyfill if necessary to window.Promise

Manual polyfill

The following snippet is equivalent to auto():

import {polyfill} from 'browser-unhandled-rejection';

if (typeof PromiseRejectionEvent !== 'undefined') {
  polyfill(); // Polyfills window.Promise


This may may useful if you don't want to mutate window.Promise:

import MyPromise from 'browser-unhandled-rejection';

window.addEventListener('unhandledrejection', () => {
  console.log('unhandledrejection was triggered');

MyPromise.reject('will trigger unhandledrejection event');

new MyPromise((resolve, reject) => {
  reject('will also trigger unhandledrejection event');
You can’t perform that action at this time.