From 3af1a3a05b8d251faaa552c8dee2b3294fc9d357 Mon Sep 17 00:00:00 2001 From: samhed Date: Thu, 2 Jun 2016 14:57:44 +0200 Subject: [PATCH] Avoid unnecessary delays We only use setTimeout() to avoid hanging the browser, not because we actually want a delay. So let's use the smallest delay there is. --- include/rfb.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rfb.js b/include/rfb.js index f426c15e..fa2401dd 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -255,7 +255,7 @@ var RFB; sendPassword: function (passwd) { this._rfb_password = passwd; this._rfb_state = 'Authentication'; - setTimeout(this._init_msg.bind(this), 1); + setTimeout(this._init_msg.bind(this), 0); }, sendCtrlAltDel: function () { @@ -549,7 +549,7 @@ var RFB; this._msgTimer = setTimeout(function () { this._msgTimer = null; this._handle_message(); - }.bind(this), 10); + }.bind(this), 0); } else { Util.Debug("More data to process, existing timer"); }