Runs every 15 min
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { stat } from "https://esm.town/v/u/stat";
import { alert } from "https://esm.town/v/u/alert";
import { msPerHour } from "https://esm.town/v/u/msPerHour";
import { refreshData } from "https://esm.town/v/u/refreshData";
export async function refresher_fetcher() {
for (const [name, time] of Object.entries(
refreshData as Record<string, number>
)) {
const hrsPassed = (Date.now() - time) / msPerHour;
if (hrsPassed > 2) {
await alert(
name,
`⚠️⚠️NO PING IN 2hr from ${name}, it's been ${stat(
name
)} mins!⚠️⚠️`
);
}
}
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023