mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Split long clear timeout delays.
window.setTimeout can not handle big delays. Fixes #180
This commit is contained in:
parent
10d9c022e0
commit
6f8f9a7e9c
2 changed files with 9 additions and 1 deletions
|
@ -81,7 +81,14 @@
|
|||
if (interval > 0){
|
||||
var timeout = settings.lastPersistentRndClearing + interval - Date.now();
|
||||
logging.message("registering persistent rng data clearing timeout. Clearing in ", timeout, "ms");
|
||||
clearTimeout = window.setTimeout(clear, timeout);
|
||||
if (timeout > 1073741824){
|
||||
// window.setTimeout can only handle delays up to 32 bit.
|
||||
// Therefore we repeat the registering afert 2^30 = 1073741824 seconds
|
||||
clearTimeout = window.setTimeout(registerTimeout, 1073741824);
|
||||
}
|
||||
else {
|
||||
clearTimeout = window.setTimeout(clear, timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
function broadcast(data){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue