+4
-5
src/App.svelte
+4
-5
src/App.svelte
···
8
9
const PLC_DIRECTORY = 'plc.directory'
10
const ROOT = 'cbab6809a136d6a621906ee11199d3b0faf85b422fe0d0d2c346ce8e9dcd7485'
11
-
const AUTO_REFRESH_INTERVAL = 15 // in seconds
12
const BUNDLE_OPS = 10_000
13
14
type Instance = {
···
43
let url: string = instance.url;
44
const start = performance.now();
45
try {
46
-
statusResp = await (await fetch(`${url}/status`)).json()
47
} catch (e) {}
48
if (!statusResp) {
49
url = `https://keyoxide.org/api/3/get/http?url=${encodeURIComponent(url)}&format=text&time=${Date.now()}`
···
106
107
recalculateHead()
108
}))
109
-
110
isUpdating = false
111
-
setTimeout(() => (canRefresh = false), 1000)
112
}
113
114
onMount(async () => {
···
137
<Switch.Label>Auto-refresh ({AUTO_REFRESH_INTERVAL}s)</Switch.Label>
138
<Switch.HiddenInput />
139
</Switch>
140
-
<button type="button" class="btn btn-sm preset-tonal-primary" onclick={() => doCheck()} disabled={canRefresh}>Refresh</button>
141
</div>
142
</header>
143
···
8
9
const PLC_DIRECTORY = 'plc.directory'
10
const ROOT = 'cbab6809a136d6a621906ee11199d3b0faf85b422fe0d0d2c346ce8e9dcd7485'
11
+
const AUTO_REFRESH_INTERVAL = 10 // in seconds
12
const BUNDLE_OPS = 10_000
13
14
type Instance = {
···
43
let url: string = instance.url;
44
const start = performance.now();
45
try {
46
+
statusResp = await (await fetch(`${url}/status?${Number(new Date())}`)).json()
47
} catch (e) {}
48
if (!statusResp) {
49
url = `https://keyoxide.org/api/3/get/http?url=${encodeURIComponent(url)}&format=text&time=${Date.now()}`
···
106
107
recalculateHead()
108
}))
109
isUpdating = false
110
+
setTimeout(() => { canRefresh = true }, 500)
111
}
112
113
onMount(async () => {
···
136
<Switch.Label>Auto-refresh ({AUTO_REFRESH_INTERVAL}s)</Switch.Label>
137
<Switch.HiddenInput />
138
</Switch>
139
+
<button type="button" class="btn btn-sm preset-tonal-primary" onclick={() => doCheck()} disabled={isUpdating || canRefresh === false}>Refresh</button>
140
</div>
141
</header>
142