Onionr/static-data/www/board/autorefresh.js

19 lines
443 B
JavaScript
Raw Normal View History

2019-07-29 04:07:29 +00:00
var checkbox = document.getElementById('refreshCheckbox')
function autoRefresh(){
if (! checkbox.checked){return}
getBlocks()
}
function setupInterval(){
if (checkbox.checked){
2019-09-06 05:18:25 +00:00
refreshInterval = setInterval(autoRefresh, 3000)
2019-07-29 04:07:29 +00:00
autoRefresh()
return
}
clearInterval(refreshInterval)
}
2019-09-06 05:18:25 +00:00
var refreshInterval = setInterval(autoRefresh, 3000)
2019-07-29 04:07:29 +00:00
setupInterval()
checkbox.onchange = function(){setupInterval}