зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1075226 - Use Array.map in Updater_fillEmptyCells r=ttaubert
This commit is contained in:
Родитель
d506248633
Коммит
e1a9cfd648
|
@ -154,14 +154,13 @@ let gUpdater = {
|
||||||
*/
|
*/
|
||||||
_fillEmptyCells: function Updater_fillEmptyCells(aLinks, aCallback) {
|
_fillEmptyCells: function Updater_fillEmptyCells(aLinks, aCallback) {
|
||||||
let {cells, sites} = gGrid;
|
let {cells, sites} = gGrid;
|
||||||
let batch = [];
|
|
||||||
|
|
||||||
// Find empty cells and fill them.
|
// Find empty cells and fill them.
|
||||||
sites.forEach(function (aSite, aIndex) {
|
Promise.all(sites.map((aSite, aIndex) => {
|
||||||
if (aSite || !aLinks[aIndex])
|
if (aSite || !aLinks[aIndex])
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
batch.push(new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
// Create the new site and fade it in.
|
// Create the new site and fade it in.
|
||||||
let site = gGrid.createSite(aLinks[aIndex], cells[aIndex]);
|
let site = gGrid.createSite(aLinks[aIndex], cells[aIndex]);
|
||||||
|
|
||||||
|
@ -172,9 +171,7 @@ let gUpdater = {
|
||||||
// the fade-in transition work.
|
// the fade-in transition work.
|
||||||
window.getComputedStyle(site.node).opacity;
|
window.getComputedStyle(site.node).opacity;
|
||||||
gTransformation.showSite(site, resolve);
|
gTransformation.showSite(site, resolve);
|
||||||
}));
|
});
|
||||||
});
|
})).then(aCallback).catch(console.exception);
|
||||||
|
|
||||||
Promise.all(batch).then(aCallback);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче