summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content/newtab/transformations.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-06-19 11:43:12 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-19 11:43:12 +0200
commitd84b169e75bbf0e4f1888e8d5287323bb3ed61da (patch)
tree90c04201734dea68283f0a6bdd5ff03153f641ee /application/palemoon/base/content/newtab/transformations.js
parente7b69b29df1593be14ce7c6efdad2f2c973a1c01 (diff)
downloadUXP-d84b169e75bbf0e4f1888e8d5287323bb3ed61da.tar
UXP-d84b169e75bbf0e4f1888e8d5287323bb3ed61da.tar.gz
UXP-d84b169e75bbf0e4f1888e8d5287323bb3ed61da.tar.lz
UXP-d84b169e75bbf0e4f1888e8d5287323bb3ed61da.tar.xz
UXP-d84b169e75bbf0e4f1888e8d5287323bb3ed61da.zip
Stop using old-style promises module in about:newtab.
- Rewrite to arrow functions. - Stop using .defer and .promised Tag #517.
Diffstat (limited to 'application/palemoon/base/content/newtab/transformations.js')
-rw-r--r--application/palemoon/base/content/newtab/transformations.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/application/palemoon/base/content/newtab/transformations.js b/application/palemoon/base/content/newtab/transformations.js
index 0711d7d0a..4fb565fb9 100644
--- a/application/palemoon/base/content/newtab/transformations.js
+++ b/application/palemoon/base/content/newtab/transformations.js
@@ -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);
+ }
},
/**