Fix #1489: PromisePolyfill always overwrites window.Promise

This commit is contained in:
valtron 2016-12-21 23:34:44 -07:00 committed by GitHub
parent bc01dad847
commit 608f9889a5

View file

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