diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-07-31 07:07:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-31 07:07:07 +0300 |
commit | b93ae1f5b35be6e1745975461d5425cac0c07d10 (patch) | |
tree | 7a963714a02dc1419f84f06334ca2e9c8eb16ddd /js/piwik.js | |
parent | 0f77746bab0ae351fd890a139bc032d33e400a4a (diff) |
Remove no longer needed/used heartbeat code (#16253)
* Remove no longer needed/used heartbeat code
Noticed `heartBeatUp` was actually no longer called since we refactored the heartbeat timer so this code should be possible to be removed
* rebuilt piwik.js
* Update startOverlaySession.twig
Diffstat (limited to 'js/piwik.js')
-rw-r--r-- | js/piwik.js | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/js/piwik.js b/js/piwik.js index e6db6e4848..309302a7a7 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -2340,9 +2340,6 @@ if (typeof window.Matomo !== 'object') { // Timestamp of last tracker request sent to Matomo lastTrackerRequestTime = null, - // Handle to the current heart beat timeout - heartBeatTimeout, - // Internal state of the pseudo click handler lastButton, lastTarget, @@ -2804,56 +2801,6 @@ if (typeof window.Matomo !== 'object') { } } - /* - * Sets up the heart beat timeout. - */ - function heartBeatUp(delay) { - if (heartBeatTimeout - || !configHeartBeatDelay - || !configHasConsent - ) { - return; - } - - heartBeatTimeout = setTimeout(function heartBeat() { - heartBeatTimeout = null; - - if (!hadWindowFocusAtLeastOnce) { - // if browser does not support .hasFocus (eg IE5), we assume that the window has focus. - hadWindowFocusAtLeastOnce = (!documentAlias.hasFocus || documentAlias.hasFocus()); - } - - if (!hadWindowFocusAtLeastOnce) { - // only send a ping if the tab actually had focus at least once. For example do not send a ping - // if window was opened via "right click => open in new window" and never had focus see #9504 - heartBeatUp(configHeartBeatDelay); - return; - } - - if (heartBeatPingIfActivityAlias()) { - return; - } - - var now = new Date(), - heartBeatDelay = configHeartBeatDelay - (now.getTime() - lastTrackerRequestTime); - // sanity check - heartBeatDelay = Math.min(configHeartBeatDelay, heartBeatDelay); - heartBeatUp(heartBeatDelay); - }, delay || configHeartBeatDelay); - } - - /* - * Removes the heart beat timeout. - */ - function heartBeatDown() { - if (!heartBeatTimeout) { - return; - } - - clearTimeout(heartBeatTimeout); - heartBeatTimeout = null; - } - function heartBeatOnFocus() { hadWindowFocusAtLeastOnce = true; timeWindowLastFocused = new Date().getTime(); @@ -2871,7 +2818,6 @@ if (typeof window.Matomo !== 'object') { if (hadWindowMinimalFocusToConsiderViewed()) { heartBeatPingIfActivityAlias(); } - heartBeatDown(); } /* @@ -6075,7 +6021,6 @@ if (typeof window.Matomo !== 'object') { * Disable heartbeat if it was previously activated. */ this.disableHeartBeatTimer = function () { - heartBeatDown(); if (configHeartBeatDelay || heartBeatSetUp) { if (windowAlias.removeEventListener) { |