diff --git a/package.json b/package.json index e031ab2..8d03b43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "incusjs", - "version": "1.0.1", + "version": "1.0.4", "description": "", "main": "src/incus.js", "scripts": { diff --git a/src/lib/presence.js b/src/lib/presence.js index 9a034dd..33a37c8 100644 --- a/src/lib/presence.js +++ b/src/lib/presence.js @@ -8,6 +8,7 @@ var Presence = function(incus, inactivityThresholdSeconds) { this.incus = incus; this.timerReference = null; this.lastActiveTime = null; + this._lastResetCall = null; this.inactivityThresholdSeconds = (typeof inactivityThresholdSeconds !== 'undefined' ? inactivityThresholdSeconds : 60); document.body.addEventListener('touchstart', this.handleUserActivity.bind(this)); @@ -66,8 +67,8 @@ Presence.prototype = { var nowUnixTimeMsec = (+ new Date); // Throttle reset commands - if(this.handleUserActivity.lastSuccessfulCall === null || this.handleUserActivity.lastSuccessfulCall + (1000 / MAXIMUM_COMMNANDS_PER_SECOND) <= nowUnixTimeMsec) { - this.handleUserActivity.lastSuccessfulCall = nowUnixTimeMsec; + if(this._lastResetCall === null || this._lastResetCall + (1000 / MAXIMUM_COMMNANDS_PER_SECOND) <= nowUnixTimeMsec) { + this._lastResetCall = nowUnixTimeMsec; this.reset(); } }