mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-17 01:50:47 -04:00
gahew
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// session Service state
|
||||
// Purpose: Stores session sync throttling state and timer references used across event handlers.
|
||||
// Scope: Keeps runtime behavior unchanged while centralizing mutable session-sync state in one module.
|
||||
let lastActivitySync = 0;
|
||||
let pendingActivitySync = null;
|
||||
let lastNightVisionSync = 0;
|
||||
let pendingNightVisionSync = null;
|
||||
|
||||
function getState() {
|
||||
return {
|
||||
lastActivitySync,
|
||||
pendingActivitySync,
|
||||
lastNightVisionSync,
|
||||
pendingNightVisionSync,
|
||||
};
|
||||
}
|
||||
|
||||
function setState(patch = {}) {
|
||||
if (Object.prototype.hasOwnProperty.call(patch, 'lastActivitySync')) {
|
||||
lastActivitySync = patch.lastActivitySync;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(patch, 'pendingActivitySync')) {
|
||||
pendingActivitySync = patch.pendingActivitySync;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(patch, 'lastNightVisionSync')) {
|
||||
lastNightVisionSync = patch.lastNightVisionSync;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(patch, 'pendingNightVisionSync')) {
|
||||
pendingNightVisionSync = patch.pendingNightVisionSync;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getState,
|
||||
setState,
|
||||
};
|
||||
Reference in New Issue
Block a user