Added autoreload
This commit is contained in:
parent
1ad1e66470
commit
c9e621571c
4 changed files with 29 additions and 0 deletions
|
|
@ -34,5 +34,26 @@
|
|||
{% endblock body %}
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
let state = {execution: null};
|
||||
const check_exec = () => {
|
||||
return fetch('/execution')
|
||||
.then(response => response.text())
|
||||
.then(data => parseInt(data))
|
||||
.catch(err => {});
|
||||
}
|
||||
window.onload = () => {
|
||||
check_exec().then(exec => {
|
||||
state.execution = exec;
|
||||
setInterval(()=>{
|
||||
check_exec().then(exec => {
|
||||
if(exec && state.execution != exec) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue