Skip to content

Instantly share code, notes, and snippets.

@molily
Created February 25, 2016 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save molily/76868187561d9e2ea569 to your computer and use it in GitHub Desktop.
Save molily/76868187561d9e2ea569 to your computer and use it in GitHub Desktop.
promisePolyfill.js
import RSVP from 'rsvp';
export default () => {
if (!window.Promise) {
window.Promise = RSVP.Promise;
// Show uncaught Promise errors on the console
RSVP.on('error', (reason) => {
/* eslint-disable no-console */
console.error('Uncaught Promise exception', reason);
/* eslint-enable no-console */
// Re-throw error
if (reason instanceof Error) {
throw reason;
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment