oops missing this file

This commit is contained in:
Eric Fredricksen authored and Eric Fredricksen committed 2021-12-13 21:24:10 -08:00
1 parent 620c850966
commit efc5475d36
1 file changed
+16
+16
View File
@@ -0,0 +1,16 @@
let timerID;
self.addEventListener('message', e => {
switch (e.data) {
case 'start':
if (!timerID) {
timerID = setInterval(() => {
self.postMessage('tick');
}, 50);
}
break;
case 'stop':
clearInterval(timerID);
timerID = null;
break;
};
}, false);