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
@ -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();
|
||||
|
Reference in New Issue
Block a user