Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: third_party/polymer/v0_8/components/promise-polyfill/Promise-Statics.js

Issue 1162563004: Upgrade to 1.0 and switch clients to dom-repeat where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a layout import and remove the gzipped webanimation in reproduce.sh Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 Promise.all = Promise.all || function () {
2 var args = Array.prototype.slice.call(arguments.length === 1 && Array.isArray( arguments[0]) ? arguments[0] : arguments);
3
4 return new Promise(function (resolve, reject) {
5 if (args.length === 0) return resolve([]);
6 var remaining = args.length;
7 function res(i, val) {
8 try {
9 if (val && (typeof val === 'object' || typeof val === 'function')) {
10 var then = val.then;
11 if (typeof then === 'function') {
12 then.call(val, function (val) { res(i, val) }, reject);
13 return;
14 }
15 }
16 args[i] = val;
17 if (--remaining === 0) {
18 resolve(args);
19 }
20 } catch (ex) {
21 reject(ex);
22 }
23 }
24 for (var i = 0; i < args.length; i++) {
25 res(i, args[i]);
26 }
27 });
28 };
29
30 Promise.race = Promise.race || function (values) {
31 return new Promise(function (resolve, reject) {
32 for(var i = 0, len = values.length; i < len; i++) {
33 values[i].then(resolve, reject);
34 }
35 });
36 };
37
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698