diff options
| author | Barak Korren <barak.korren@gmail.com> | 2013-04-02 20:38:07 +0300 |
|---|---|---|
| committer | Barak Korren <barak.korren@gmail.com> | 2013-04-02 20:38:07 +0300 |
| commit | 58a2577d48790c79adfd44bcfd662c980ce6cfe4 (patch) | |
| tree | 523d814ea0b7b6f617fe515b186099c6e83fed72 /lib/dojo/promise/first.js.uncompressed.js | |
| parent | e470a273cf09562fb2f9c0c899002303f19c8d16 (diff) | |
| parent | cc332603431102a682feda22b9cf0093a29f0176 (diff) | |
Merge branch 'master' of https://github.com/gothfox/Tiny-Tiny-RSS.git
Diffstat (limited to 'lib/dojo/promise/first.js.uncompressed.js')
| -rw-r--r-- | lib/dojo/promise/first.js.uncompressed.js | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/dojo/promise/first.js.uncompressed.js b/lib/dojo/promise/first.js.uncompressed.js deleted file mode 100644 index 863573fa1..000000000 --- a/lib/dojo/promise/first.js.uncompressed.js +++ /dev/null @@ -1,49 +0,0 @@ -define("dojo/promise/first", [ - "../_base/array", - "../Deferred", - "../when" -], function(array, Deferred, when){ - "use strict"; - - // module: - // dojo/promise/first - - var forEach = array.forEach; - - return function first(objectOrArray){ - // summary: - // Takes multiple promises and returns a new promise that is fulfilled - // when the first of these promises is fulfilled. - // description: - // Takes multiple promises and returns a new promise that is fulfilled - // when the first of these promises is fulfilled. Canceling the returned - // promise will *not* cancel any passed promises. The promise will be - // fulfilled with the value of the first fulfilled promise. - // objectOrArray: Object|Array? - // The promises are taken from the array or object values. If no value - // is passed, the returned promise is resolved with an undefined value. - // returns: dojo/promise/Promise - - var array; - if(objectOrArray instanceof Array){ - array = objectOrArray; - }else if(objectOrArray && typeof objectOrArray === "object"){ - array = []; - for(var key in objectOrArray){ - if(Object.hasOwnProperty.call(objectOrArray, key)){ - array.push(objectOrArray[key]); - } - } - } - - if(!array || !array.length){ - return new Deferred().resolve(); - } - - var deferred = new Deferred(); - forEach(array, function(valueOrPromise){ - when(valueOrPromise, deferred.resolve, deferred.reject); - }); - return deferred.promise; // dojo/promise/Promise - }; -}); |