expose promise polyfill in a way that won't need code migration later

This commit is contained in:
Leo Horie 2016-11-16 21:15:23 -05:00
parent 62724a1143
commit 439cf95673
7 changed files with 60 additions and 95 deletions

View file

@ -95,4 +95,9 @@ PromisePolyfill.race = function(list) {
})
}
module.exports = typeof Promise !== "undefined" ? Promise : PromisePolyfill
if (typeof Promise === "undefined") {
if (typeof window !== "undefined") window.Promise = PromisePolyfill
else if (typeof global !== "undefined") global.Promise = PromisePolyfill
}
module.exports = typeof Promise !== "undefined" ? Promise : PromisePolyfill