cleanup: Use arrow notation for anonymous functions

Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:
Florian Müllner
2017-10-31 01:38:18 +01:00
committed by Florian Müllner
parent 76f09b1e49
commit 213e38c2ef
105 changed files with 2165 additions and 2408 deletions

View File

@ -26,7 +26,7 @@ var RfkillManager = new Lang.Class({
_init() {
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
Lang.bind(this, function(proxy, error) {
(proxy, error) => {
if (error) {
log(error.message);
return;
@ -34,7 +34,7 @@ var RfkillManager = new Lang.Class({
this._proxy.connect('g-properties-changed',
Lang.bind(this, this._changed));
this._changed();
}));
});
},
get airplaneMode() {
@ -87,9 +87,9 @@ var Indicator = new Lang.Class({
// changing the menu contents.
this._item = new PopupMenu.PopupSubMenuMenuItem(_("Airplane Mode On"), true);
this._item.icon.icon_name = 'airplane-mode-symbolic';
this._offItem = this._item.menu.addAction(_("Turn Off"), Lang.bind(this, function() {
this._offItem = this._item.menu.addAction(_("Turn Off"), () => {
this._manager.airplaneMode = false;
}));
});
this._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop');
this.menu.addMenuItem(this._item);