Missing file

This commit is contained in:
Gabe Kangas 2022-05-09 13:06:17 -07:00
parent 97762c17b0
commit d6e0b55337
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA

View File

@ -0,0 +1,28 @@
const URL = '/api/ping';
const INTERVAL = 4000;
function ping() {
try {
fetch(URL);
} catch (e) {
console.error(e);
}
}
class ViewerPing {
timer: ReturnType<typeof setInterval>;
start() {
this.stop();
this.timer = setInterval(() => {
ping();
}, INTERVAL);
}
stop() {
clearInterval(this.timer);
}
}
export default ViewerPing;