Bundled output for commit 0b83c29ab6 [skip ci]
This commit is contained in:
parent
0b83c29ab6
commit
550ad86ec5
3 changed files with 72 additions and 50 deletions
26
mithril.js
26
mithril.js
|
|
@ -174,6 +174,20 @@ PromisePolyfill.prototype.then = function(onFulfilled, onRejection) {
|
|||
PromisePolyfill.prototype.catch = function(onRejection) {
|
||||
return this.then(null, onRejection)
|
||||
}
|
||||
PromisePolyfill.prototype.finally = function(callback) {
|
||||
return this.then(
|
||||
function(value) {
|
||||
return PromisePolyfill.resolve(callback()).then(function() {
|
||||
return value
|
||||
})
|
||||
},
|
||||
function(reason) {
|
||||
return PromisePolyfill.resolve(callback()).then(function() {
|
||||
return PromisePolyfill.reject(reason);
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
PromisePolyfill.resolve = function(value) {
|
||||
if (value instanceof PromisePolyfill) return value
|
||||
return new PromisePolyfill(function(resolve) {resolve(value)})
|
||||
|
|
@ -208,10 +222,18 @@ PromisePolyfill.race = function(list) {
|
|||
})
|
||||
}
|
||||
if (typeof window !== "undefined") {
|
||||
if (typeof window.Promise === "undefined") window.Promise = PromisePolyfill
|
||||
if (typeof window.Promise === "undefined") {
|
||||
window.Promise = PromisePolyfill
|
||||
} else if (!window.Promise.prototype.finally) {
|
||||
window.Promise.prototype.finally = PromisePolyfill.prototype.finally
|
||||
}
|
||||
var PromisePolyfill = window.Promise
|
||||
} else if (typeof global !== "undefined") {
|
||||
if (typeof global.Promise === "undefined") global.Promise = PromisePolyfill
|
||||
if (typeof global.Promise === "undefined") {
|
||||
global.Promise = PromisePolyfill
|
||||
} else if (!global.Promise.prototype.finally) {
|
||||
global.Promise.prototype.finally = PromisePolyfill.prototype.finally
|
||||
}
|
||||
var PromisePolyfill = global.Promise
|
||||
} else {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue