0001-do-not-refresh-table-when-tab-is-invisible-or-user-i.patch
wcs/qommon/static/js/wcs.listing.js | ||
---|---|---|
188 | 188 |
return false; |
189 | 189 |
}); |
190 | 190 | |
191 |
/* refresh every 30 seconds (idle_id) after any user activity |
|
192 |
* on inactivity for more than 5 minutes (longidle_id), stop refreshing (clear idle_id) |
|
193 |
*/ |
|
191 | 194 |
if ($('#statistics').length == 0) { |
192 | 195 |
var idle_id = null; |
196 |
var longidle_id = null; |
|
193 | 197 |
$(window).on('mousemove keydown mousedown touchstart', function() { |
198 |
/* if refresh timer exists, clear it */ |
|
194 | 199 |
if (idle_id) window.clearInterval(idle_id); |
200 |
/* if stop refreshing timer exists, clear it */ |
|
201 |
if (longidle_id) window.clearTimeout(longidle_id); |
|
202 |
/* launch timer to refresh every 30 seconds */ |
|
195 | 203 |
idle_id = setInterval(autorefresh_table, 30000); |
204 |
/* launch timer to stop refreshing after 5 minutes idle */ |
|
205 |
longidle_id = setTimeout(function () { |
|
206 |
if (idle_id) idle_id = window.clearInterval(idle_id); |
|
207 |
longidle_id = undefined; |
|
208 |
}, 300 * 1000); |
|
196 | 209 |
}); |
197 | 210 |
} |
198 | 211 | |
199 |
- |