browser-unhandled-rejection
A ponyfill/polyfill for browser Promise unhandledrejection
events.
See: https://www.chromestatus.com/features/4805872211460096
Install
npm i browser-unhandled-rejection
or
yarn add browser-unhandled-rejection
Usage
Automatic polyfill
This automatically applies the polyfill to the global Promise
object if it is needed.
; ; // Applies polyfill if necessary to window.Promise
Manual polyfill
The following snippet is equivalent to auto()
:
; if typeof PromiseRejectionEvent !== 'undefined' ; // Polyfills window.Promise
Ponyfill
This may may useful if you don't want to mutate window.Promise
:
; window; MyPromise; { ;};