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

@ -60,7 +60,7 @@ var ModalDialog = new Lang.Class({
coordinate: Clutter.BindCoordinate.ALL });
this._group.add_constraint(constraint);
this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy));
this._group.connect('destroy', this._onGroupDestroy.bind(this));
this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
this._backgroundBin = new St.Bin({ child: this.backgroundStack,
@ -194,8 +194,7 @@ var ModalDialog = new Lang.Class({
{ opacity: 0,
time: OPEN_AND_CLOSE_TIME,
transition: 'easeOutQuad',
onComplete: Lang.bind(this,
this._closeComplete)
onComplete: this._closeComplete.bind(this)
})
else
this._closeComplete();