Log number of loaded icons

This commit is contained in:
Vjacheslav Trushkin 2018-10-13 09:42:43 +03:00
parent 6c2dc5ae73
commit b9541a44b0
1 changed files with 18 additions and 3 deletions

View File

@ -159,7 +159,16 @@ class Collections {
}
});
Promise.all(promises).then(() => {
Promise.all(promises).then(res => {
let total = 0;
res.forEach(count => {
if (typeof count === 'number') {
total += count;
}
});
if (this._log !== null) {
this._log('Loaded ' + total + ' icons');
}
fulfill(this);
}).catch(err => {
reject(err);
@ -194,7 +203,13 @@ class Collections {
// Load all promises
Promise.all(promises).then(res => {
fulfill(true);
let total = 0;
res.forEach(count => {
if (typeof count === 'number') {
total += count;
}
});
fulfill(total);
}).catch(err => {
fulfill(false);
});
@ -254,7 +269,7 @@ class Collections {
if (this._log !== null) {
this._log('Loaded collection ' + prefix + ' from ' + file + ' (' + count + ' icons)');
}
fulfill(true);
fulfill(count);
}).catch(() => {
fulfill(false);
});