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:
Florian Müllner
2017-12-02 01:27:35 +01:00
committed by Florian Müllner
parent 213e38c2ef
commit 3b1330880f
100 changed files with 1021 additions and 999 deletions

View File

@ -49,10 +49,10 @@ var RunDialog = new Lang.Class({
Main.createLookingGlass().open();
},
'r': Lang.bind(this, this._restart),
'r': this._restart.bind(this),
// Developer brain backwards compatibility
'restart': Lang.bind(this, this._restart),
'restart': this._restart.bind(this),
'debugexit': () => {
Meta.quit(Meta.ExitCode.ERROR);
@ -106,7 +106,7 @@ var RunDialog = new Lang.Class({
this._errorBox.hide();
this.setButtons([{ action: Lang.bind(this, this.close),
this.setButtons([{ action: this.close.bind(this),
label: _("Close"),
key: Clutter.Escape }]);