No need to use a separate 'that' variable in the _slurpMessage function

Storing 'this' into a separate variable, typically called 'that,' is
needed only to enable it to be captured in a (callback) function that
you create in the scope of the 'that' variable. No callback or other
function is created inside the _slurpMessage function.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Iae2c6844a3dfb0ff486ee6762ee129893829f272
This commit is contained in:
Tor Lillqvist 2021-09-21 16:20:33 +03:00 committed by Tor Lillqvist
parent 12e9ed689f
commit 0243441dba

View file

@ -358,13 +358,12 @@ app.definitions.Socket = L.Class.extend({
// buffer of web-socket messages in the client that we can't
// process so - slurp and the emit at idle - its faster to delay!
_slurpMessage: function(e) {
var that = this;
if (!this._slurpQueue || !this._slurpQueue.length) {
this._queueSlurpEventEmission();
that._slurpQueue = [];
this._slurpQueue = [];
}
this._extractTextImg(e);
that._slurpQueue.push(e);
this._slurpQueue.push(e);
},
// make profiling easier