[gnome-shell/wip/msanchez/620106: 1/2] Use arrow functions for callbacks



commit 5678239a9e4f0415ead8ea1ddd7200881bc231c5
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Thu Nov 30 19:51:17 2017 +0000

    Use arrow functions for callbacks
    
    https://bugzilla.gnome.org/show_bug.cgi?id=620106

 js/ui/altTab.js |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 4cd4f66..1a22afb 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -354,10 +354,10 @@ var AppSwitcherPopup = new Lang.Class({
         this._thumbnails = new ThumbnailList (this._items[this._selectedIndex].cachedWindows);
         this._thumbnails.connect('item-activated', Lang.bind(this, this._windowActivated));
         this._thumbnails.connect('item-entered', Lang.bind(this, this._windowEntered));
-        this._thumbnails.actor.connect('destroy', Lang.bind(this, function() {
+        this._thumbnails.actor.connect('destroy', () => {
             this._thumbnails = null;
             this._thumbnailsFocused = false;
-        }));
+        });
 
         this.actor.add_actor(this._thumbnails.actor);
 
@@ -778,11 +778,10 @@ var AppSwitcher = new Lang.Class({
         this.icons.push(appIcon);
         let item = this.addItem(appIcon.actor, appIcon.label);
 
-        appIcon._stateChangedId = appIcon.app.connect('notify::state',
-            Lang.bind(this, function(app) {
-                if (app.state != Shell.AppState.RUNNING)
-                    this._removeIcon(app);
-            }));
+        appIcon._stateChangedId = appIcon.app.connect('notify::state', (app) => {
+            if (app.state != Shell.AppState.RUNNING)
+                this._removeIcon(app);
+        });
 
         let n = this._arrows.length;
         let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
@@ -849,7 +848,7 @@ var ThumbnailList = new Lang.Class({
 
         }
 
-        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
+        this.actor.connect('destroy', () => { this._onDestroy(); });
     },
 
     addClones : function (availHeight) {
@@ -875,8 +874,7 @@ var ThumbnailList = new Lang.Class({
             this._thumbnailBins[i].set_height(binHeight);
             this._thumbnailBins[i].add_actor(clone);
 
-            clone._destroyId = mutterWindow.connect('destroy',
-                                                    Lang.bind(this, this._removeThumbnail, clone));
+            clone._destroyId = mutterWindow.connect('destroy', () => { this._removeThumbnail(clone); });
             this._clones.push(clone);
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]