Created
February 25, 2016 14:58
-
-
Save molily/76868187561d9e2ea569 to your computer and use it in GitHub Desktop.
promisePolyfill.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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