mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 15:57:50 +01:00
update comments in timer modules
This commit is contained in:
@@ -3,7 +3,8 @@ A timer using setTimeout that compensates for drift. Drift can happen for severa
|
||||
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#reasons_for_delays
|
||||
|
||||
This means the timer may very well be late in executing the next call (but never early).
|
||||
This timer is accurate to within a few ms for any amount of time provided. It's meant to be utilized as a Web Worker.
|
||||
This timer is accurate to within a few ms for any amount of time provided. This is the client-side version of this module,
|
||||
and is meant to be utilized as a Web Worker.
|
||||
See: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ const game = () => {
|
||||
toast('Disconnected. Attempting reconnect...', 'error', true, false);
|
||||
});
|
||||
socket.on('connect', () => {
|
||||
console.log('fired connect event');
|
||||
socket.emit(globals.COMMANDS.GET_ENVIRONMENT, function (returnedEnvironment) {
|
||||
timerWorker = new Worker(new URL('../modules/Timer.js', import.meta.url));
|
||||
prepareGamePage(returnedEnvironment, socket, timerWorker);
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
A timer using setTimeout that compensates for drift. Drift can happen for several reasons:
|
||||
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#reasons_for_delays
|
||||
|
||||
This means the timer may very well be late in executing the next call (but never early).
|
||||
This timer is accurate to within a few ms for any amount of time provided.
|
||||
*/
|
||||
|
||||
function stepFn (serverTimerInstance, expected) {
|
||||
const now = Date.now(); //
|
||||
|
||||
Reference in New Issue
Block a user