mithril-vndb/promise/promise.js
2018-02-19 17:48:36 -05:00

21 lines
659 B
JavaScript

"use strict"
var PromisePolyfill = require("./polyfill")
if (typeof window !== "undefined") {
if (typeof window.Promise === "undefined") {
window.Promise = PromisePolyfill
} else if (!window.Promise.prototype.finally) {
window.Promise.prototype.finally = PromisePolyfill.prototype.finally
}
module.exports = window.Promise
} else if (typeof global !== "undefined") {
if (typeof global.Promise === "undefined") {
global.Promise = PromisePolyfill
} else if (!global.Promise.prototype.finally) {
global.Promise.prototype.finally = PromisePolyfill.prototype.finally
}
module.exports = global.Promise
} else {
module.exports = PromisePolyfill
}