mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-11 17:57:32 +09:00
Stop using old-style promises module in about:newtab.
- Rewrite to arrow functions. - Stop using .defer and .promised Tag #517.
This commit is contained in:
parent
5c9e19b2cc
commit
d767e24977
3 changed files with 40 additions and 50 deletions
|
|
@ -179,23 +179,23 @@ var gTransformation = {
|
|||
if (!aSite || aSite == gDrag.draggedSite)
|
||||
return;
|
||||
|
||||
let deferred = Promise.defer();
|
||||
batch.push(deferred.promise);
|
||||
let cb = function () deferred.resolve();
|
||||
|
||||
if (!cells[aIndex])
|
||||
batch.push(new Promise(resolve => {
|
||||
if (!cells[aIndex]) {
|
||||
// The site disappeared from the grid, hide it.
|
||||
this.hideSite(aSite, cb);
|
||||
else if (this._getNodeOpacity(aSite.node) != 1)
|
||||
this.hideSite(aSite, resolve);
|
||||
} else if (this._getNodeOpacity(aSite.node) != 1) {
|
||||
// The site disappeared before but is now back, show it.
|
||||
this.showSite(aSite, cb);
|
||||
else
|
||||
this.showSite(aSite, resolve);
|
||||
} else {
|
||||
// The site's position has changed, move it around.
|
||||
this._moveSite(aSite, aIndex, {unfreeze: unfreeze, callback: cb});
|
||||
this._moveSite(aSite, aIndex, {unfreeze: unfreeze, callback: resolve});
|
||||
}
|
||||
}));
|
||||
}, this);
|
||||
|
||||
let wait = Promise.promised(function () callback && callback());
|
||||
wait.apply(null, batch);
|
||||
if (callback) {
|
||||
Promise.all(batch).then(callback);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue