cleanup: Use arrow notation for anonymous functions

Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:
Florian Müllner
2017-10-31 01:38:18 +01:00
committed by Florian Müllner
parent 76f09b1e49
commit 213e38c2ef
105 changed files with 2165 additions and 2408 deletions

View File

@ -69,7 +69,7 @@ var BoxPointer = new Lang.Class({
_muteInput() {
if (this._capturedEventId == 0)
this._capturedEventId = this.actor.connect('captured-event',
function() { return Clutter.EVENT_STOP; });
() => Clutter.EVENT_STOP);
},
_unmuteInput() {
@ -112,11 +112,11 @@ var BoxPointer = new Lang.Class({
xOffset: 0,
yOffset: 0,
transition: 'linear',
onComplete: Lang.bind(this, function() {
onComplete: () => {
this._unmuteInput();
if (onComplete)
onComplete();
}),
},
time: animationTime });
},
@ -156,14 +156,14 @@ var BoxPointer = new Lang.Class({
yOffset: yOffset,
transition: 'linear',
time: animationTime,
onComplete: Lang.bind(this, function () {
onComplete: () => {
this.actor.hide();
this.opacity = 0;
this.xOffset = 0;
this.yOffset = 0;
if (onComplete)
onComplete();
})
}
});
},
@ -623,10 +623,10 @@ var BoxPointer = new Lang.Class({
if (this._arrowSide != arrowSide) {
this._arrowSide = arrowSide;
this._reposition();
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._container.queue_relayout();
return false;
}));
});
this.emit('arrow-side-changed');
}