mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 22:45:56 +00:00
update dojo to 1.7.3
This commit is contained in:
@@ -4,82 +4,5 @@
|
||||
see: http://dojotoolkit.org/license for details
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo.DeferredList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo.DeferredList"] = true;
|
||||
dojo.provide("dojo.DeferredList");
|
||||
|
||||
|
||||
dojo.DeferredList = function(/*Array*/ list, /*Boolean?*/ fireOnOneCallback, /*Boolean?*/ fireOnOneErrback, /*Boolean?*/ consumeErrors, /*Function?*/ canceller){
|
||||
// summary:
|
||||
// Provides event handling for a group of Deferred objects.
|
||||
// description:
|
||||
// DeferredList takes an array of existing deferreds and returns a new deferred of its own
|
||||
// this new deferred will typically have its callback fired when all of the deferreds in
|
||||
// the given list have fired their own deferreds. The parameters `fireOnOneCallback` and
|
||||
// fireOnOneErrback, will fire before all the deferreds as appropriate
|
||||
//
|
||||
// list:
|
||||
// The list of deferreds to be synchronizied with this DeferredList
|
||||
// fireOnOneCallback:
|
||||
// Will cause the DeferredLists callback to be fired as soon as any
|
||||
// of the deferreds in its list have been fired instead of waiting until
|
||||
// the entire list has finished
|
||||
// fireonOneErrback:
|
||||
// Will cause the errback to fire upon any of the deferreds errback
|
||||
// canceller:
|
||||
// A deferred canceller function, see dojo.Deferred
|
||||
var resultList = [];
|
||||
dojo.Deferred.call(this);
|
||||
var self = this;
|
||||
if(list.length === 0 && !fireOnOneCallback){
|
||||
this.resolve([0, []]);
|
||||
}
|
||||
var finished = 0;
|
||||
dojo.forEach(list, function(item, i){
|
||||
item.then(function(result){
|
||||
if(fireOnOneCallback){
|
||||
self.resolve([i, result]);
|
||||
}else{
|
||||
addResult(true, result);
|
||||
}
|
||||
},function(error){
|
||||
if(fireOnOneErrback){
|
||||
self.reject(error);
|
||||
}else{
|
||||
addResult(false, error);
|
||||
}
|
||||
if(consumeErrors){
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
});
|
||||
function addResult(succeeded, result){
|
||||
resultList[i] = [succeeded, result];
|
||||
finished++;
|
||||
if(finished === list.length){
|
||||
self.resolve(resultList);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
dojo.DeferredList.prototype = new dojo.Deferred();
|
||||
|
||||
dojo.DeferredList.prototype.gatherResults= function(deferredList){
|
||||
// summary:
|
||||
// Gathers the results of the deferreds for packaging
|
||||
// as the parameters to the Deferred Lists' callback
|
||||
|
||||
var d = new dojo.DeferredList(deferredList, false, true, false);
|
||||
d.addCallback(function(results){
|
||||
var ret = [];
|
||||
dojo.forEach(results, function(result){
|
||||
ret.push(result[1]);
|
||||
});
|
||||
return ret;
|
||||
});
|
||||
return d;
|
||||
};
|
||||
|
||||
}
|
||||
//>>built
|
||||
define("dojo/DeferredList",["./_base/kernel","./_base/Deferred","./_base/array"],function(_1,_2,_3){_1.DeferredList=function(_4,_5,_6,_7,_8){var _9=[];_2.call(this);var _a=this;if(_4.length===0&&!_5){this.resolve([0,[]]);}var _b=0;_3.forEach(_4,function(_c,i){_c.then(function(_d){if(_5){_a.resolve([i,_d]);}else{_e(true,_d);}},function(_f){if(_6){_a.reject(_f);}else{_e(false,_f);}if(_7){return null;}throw _f;});function _e(_10,_11){_9[i]=[_10,_11];_b++;if(_b===_4.length){_a.resolve(_9);}};});};_1.DeferredList.prototype=new _2();_1.DeferredList.prototype.gatherResults=function(_12){var d=new _1.DeferredList(_12,false,true,false);d.addCallback(function(_13){var ret=[];_3.forEach(_13,function(_14){ret.push(_14[1]);});return ret;});return d;};return _1.DeferredList;});
|
||||
Reference in New Issue
Block a user