Move load function to interval in main
Took 6 minutes
This commit is contained in:
parent
672a770ac1
commit
7fff15e68d
@ -26,10 +26,18 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
|
|
||||||
setupOnClickEvents();
|
setupOnClickEvents();
|
||||||
|
|
||||||
|
// Wait because sometimes the browser isn't ready for this dom update :(
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
WebWebSocketHandler.request(RequestType.CONTAINERS).then(Setup.onContainerUpdate);
|
WebWebSocketHandler.request(RequestType.CONTAINERS).then(Setup.onContainerUpdate);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
setTimeout(load, 100);
|
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
if(!time ) return;
|
||||||
|
|
||||||
|
let currentDate = new Date();
|
||||||
|
time.innerText = "" + (currentDate.getHours() < 10 ? "0" + currentDate.getHours() : currentDate.getHours()) + ":" + (currentDate.getMinutes() < 10 ? "0" + currentDate.getMinutes() : currentDate.getMinutes());
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupOnClickEvents() {
|
function setupOnClickEvents() {
|
||||||
@ -112,16 +120,6 @@ function setupOnClickEvents() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load() {
|
|
||||||
if (!main || !time)
|
|
||||||
return;
|
|
||||||
|
|
||||||
setInterval(() => {
|
|
||||||
let currentDate = new Date();
|
|
||||||
time.innerText = "" + (currentDate.getHours() < 10 ? "0" + currentDate.getHours() : currentDate.getHours()) + ":" + (currentDate.getMinutes() < 10 ? "0" + currentDate.getMinutes() : currentDate.getMinutes());
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
let wsHandler;
|
let wsHandler;
|
||||||
|
|
||||||
function connect(): Promise<void> {
|
function connect(): Promise<void> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user