From 44a4a4aeb45a4b8a9b285d418f3191b77dd69e23 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 4 Mar 2018 09:17:27 -0700 Subject: [PATCH] Updates to idle monitor inc. ability to disable --- core/client.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/core/client.js b/core/client.js index 58700c8f..24c8b1d1 100644 --- a/core/client.js +++ b/core/client.js @@ -414,26 +414,28 @@ Client.prototype.setTermType = function(termType) { }; Client.prototype.startIdleMonitor = function() { - var self = this; - - self.lastKeyPressMs = Date.now(); + this.lastKeyPressMs = Date.now(); // // Every 1m, check for idle. // - self.idleCheck = setInterval(function checkForIdle() { + this.idleCheck = setInterval( () => { const nowMs = Date.now(); - const idleLogoutSeconds = self.user.isAuthenticated() ? + const idleLogoutSeconds = this.user.isAuthenticated() ? Config.misc.idleLogoutSeconds : Config.misc.preAuthIdleLogoutSeconds; - if(nowMs - self.lastKeyPressMs >= (idleLogoutSeconds * 1000)) { - self.emit('idle timeout'); + if(nowMs - this.lastKeyPressMs >= (idleLogoutSeconds * 1000)) { + this.emit('idle timeout'); } }, 1000 * 60); }; +Client.prototype.stopIdleMonitor = function() { + clearInterval(this.idleCheck); +}; + Client.prototype.end = function () { if(this.term) { this.term.disconnect(); @@ -445,7 +447,7 @@ Client.prototype.end = function () { currentModule.leave(); } - clearInterval(this.idleCheck); + this.stopIdleMonitor(); try { //