This commit is contained in:
Aeris 2018-08-22 21:47:16 +02:00
parent b822fb9c1c
commit 28ff965d41

View File

@ -12,6 +12,11 @@
<form id='in'>
</form>
</div>
<div id='log'>
<textarea id='logs'>
</textarea>
</div>
<script>
function generateInput(parameters){
@ -52,6 +57,17 @@
}
//async function initLog(){
// socket = new WebSocket ( "/logs" );
// socket.onmessage = function ( evt ) { document.getElementById('logs').innerHTML += evt.data; };
//}
var sleep = time => new Promise(resolve => setTimeout(resolve, time))
var poll = (promiseFn, time) => promiseFn().then(
sleep(time).then(() => poll(promiseFn, time)))
poll(() => new Promise(() => fetch("/apps/log").then(res => res.text().then(e => { document.getElementById('logs').innerHTML += e})) ), 1000)
let apps = fetch("/apps/list").then(res => res.json().then(generateInput));
//generateInput("[ \"bla\", \"foo\", \"baz\" ]");