var ref_tmr = 0; function ref_status(seti) { clearTimeout(ref_tmr); var rt = document.getElementById('refresh_time'); const setintv = (seti && rt.checkValidity()) ? '?'+rt.value : ''; fetchconfig('sys/getstatus' + setintv) .then((map) => initform('getstatus',map,true)) .catch(err => {}) .finally (() => { const when = parseInt(valval(rt)) * 1000; ref_tmr = setTimeout(ref_status, when); }); fetchconfig('version') .then((map) => initform('getstatus',map,true)) .catch(err => {}); }