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
@ -12,7 +12,7 @@ var WindowAttentionHandler = new Lang.Class({
|
||||
_init() {
|
||||
this._tracker = Shell.WindowTracker.get_default();
|
||||
this._windowDemandsAttentionId = global.display.connect('window-demands-attention',
|
||||
Lang.bind(this, this._onWindowDemandsAttention));
|
||||
this._onWindowDemandsAttention.bind(this));
|
||||
},
|
||||
|
||||
_getTitleAndBanner(app, window) {
|
||||
@ -72,7 +72,7 @@ var Source = new Lang.Class({
|
||||
this.signalIDs.push(this._window.connect('unmanaged',
|
||||
() => { this.destroy(); }));
|
||||
|
||||
this.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
},
|
||||
|
||||
_onDestroy() {
|
||||
|
Reference in New Issue
Block a user