Browse Source

Missing file

pull/2032/head
Gabe Kangas 3 years ago
parent
commit
d6e0b55337
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
  1. 28
      web/components/video/viewer-ping.ts

28
web/components/video/viewer-ping.ts

@ -0,0 +1,28 @@ @@ -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;
Loading…
Cancel
Save