mirror of
https://github.com/cjdenio/uta-trax-api.git
synced 2026-12-01 00:26:25 +00:00
loading screen
This commit is contained in:
5 files changed
+83
-20
No files matched your search
+9
-2
@@ -288,6 +288,8 @@ function renderVehicle(vehicle) {
|
||||
});
|
||||
}
|
||||
|
||||
let isLoaded = false
|
||||
|
||||
async function reload() {
|
||||
const { vehicles = [], info } = await fetch("/api", { headers: { Accept: "application/json" } }).then((r) => r.json());
|
||||
|
||||
@@ -344,12 +346,17 @@ async function reload() {
|
||||
currentVehicles.delete(key)
|
||||
}
|
||||
}
|
||||
|
||||
if (!isLoaded) {
|
||||
document.getElementById("loader").classList.add("loader--hidden")
|
||||
isLoaded = true
|
||||
}
|
||||
|
||||
setTimeout(() => reload(), 5000);
|
||||
}
|
||||
|
||||
reload();
|
||||
|
||||
setInterval(reload, 5000);
|
||||
|
||||
Alpine.data('app', () => ({
|
||||
busLayer: true,
|
||||
brtLayer: true,
|
||||
|
||||
Reference in new issue
Block a user