cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind() to bind `this` to named callbacks. However since ES5, this functionality is already provided by Function.prototype.bind() - in fact, Lang.bind() itself uses it when no extra arguments are specified. Just use the built-in function directly where possible, and use arrow notation in the few places where we pass additional arguments. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:

committed by
Florian Müllner

parent
213e38c2ef
commit
3b1330880f
@ -109,10 +109,10 @@ var OsdWindow = new Lang.Class({
|
||||
this._reset();
|
||||
|
||||
Main.layoutManager.connect('monitors-changed',
|
||||
Lang.bind(this, this._relayout));
|
||||
this._relayout.bind(this));
|
||||
let themeContext = St.ThemeContext.get_for_stage(global.stage);
|
||||
themeContext.connect('notify::scale-factor',
|
||||
Lang.bind(this, this._relayout));
|
||||
this._relayout.bind(this));
|
||||
this._relayout();
|
||||
Main.uiGroup.add_child(this.actor);
|
||||
},
|
||||
@ -159,7 +159,7 @@ var OsdWindow = new Lang.Class({
|
||||
if (this._hideTimeoutId)
|
||||
Mainloop.source_remove(this._hideTimeoutId);
|
||||
this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT,
|
||||
Lang.bind(this, this._hide));
|
||||
this._hide.bind(this));
|
||||
GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
|
||||
},
|
||||
|
||||
@ -215,7 +215,7 @@ var OsdWindowManager = new Lang.Class({
|
||||
_init() {
|
||||
this._osdWindows = [];
|
||||
Main.layoutManager.connect('monitors-changed',
|
||||
Lang.bind(this, this._monitorsChanged));
|
||||
this._monitorsChanged.bind(this));
|
||||
this._monitorsChanged();
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user