mirror of
https://github.com/correl/melpa.git
synced 2024-12-19 03:00:50 +00:00
Temporarily patch an upstream issue in mithril
This commit is contained in:
parent
75c492f9b7
commit
fe786ec49d
1 changed files with 25 additions and 0 deletions
|
@ -11,6 +11,31 @@
|
|||
// TODO Show recent github events on package pages where applicable
|
||||
// TODO Voting / starring
|
||||
|
||||
// Temporary fix pending https://github.com/lhorie/mithril.js/issues/101 upstream
|
||||
m.sync = function(args) {
|
||||
var method = "resolve"
|
||||
function synchronizer(pos, resolved) {
|
||||
return function(value) {
|
||||
--outstanding
|
||||
results[pos] = value
|
||||
if (!resolved) method = "reject"
|
||||
if (outstanding == 0) {
|
||||
deferred.promise(results)
|
||||
deferred[method](results)
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
var deferred = m.deferred()
|
||||
var outstanding = args.length
|
||||
var results = new Array(outstanding)
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i].then(synchronizer(i, true), synchronizer(false))
|
||||
}
|
||||
return deferred.promise
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers
|
||||
|
|
Loading…
Reference in a new issue