diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-01-10 11:34:30 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-01-10 11:34:30 +0800 |
| commit | 0a18ee1c89962cfee6b81b018d9bb7d007d486f7 (patch) | |
| tree | 613fae6c6f08f408b489424ec2a3850b3a028179 /public | |
| parent | 409a97f13b17c6a9423a958a2e7c4dd0fd029671 (diff) | |
globaled mainInterval
Diffstat (limited to 'public')
| -rw-r--r-- | public/js/randomblob.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/public/js/randomblob.js b/public/js/randomblob.js index 5ea80ed1..a32045f2 100644 --- a/public/js/randomblob.js +++ b/public/js/randomblob.js @@ -1,6 +1,7 @@ "use strict"; var isFirstTime = true; +var mainInterval; function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); @@ -50,9 +51,10 @@ function main() { resetBlob(); isFirstTime = false; } - setTimeout(main, getRandomInt(7500, 30000)); + mainInterval = setTimeout(main, getRandomInt(7500, 30000)); } blob.addEventListener('click', function () { + clearTimeout(mainInterval); main(getRandomInt(7500, 30000)); }); main();
\ No newline at end of file |
