mirror of
https://github.com/myronblair/jarvis
synced 2026-06-30 17:50:23 -05:00
Add idle reload: full page refresh after 5min inactivity
This commit is contained in:
@@ -885,10 +885,15 @@ let faceLoopId = null;
|
||||
let lastFaceSeen = 0;
|
||||
let autoMicCooldown = 0;
|
||||
let faceApiReady = false;
|
||||
let lastActivity = Date.now();
|
||||
const IDLE_RELOAD_MS = 5 * 60 * 1000; // 5 min inactivity → full reload
|
||||
const FACE_MODEL_URL = 'https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js@0.22.2/weights';
|
||||
|
||||
// ── INIT ─────────────────────────────────────────────────────────────
|
||||
window.addEventListener('load', () => {
|
||||
window.addEventListener("load", () => {
|
||||
["mousemove","keydown","touchstart","click"].forEach(e =>
|
||||
window.addEventListener(e, () => { lastActivity = Date.now(); }, {passive:true})
|
||||
);
|
||||
updateClock();
|
||||
setInterval(updateClock, 1000);
|
||||
initVoice();
|
||||
@@ -954,6 +959,7 @@ function showApp(name, greeting) {
|
||||
// Start data refresh
|
||||
refreshAll();
|
||||
refreshTimer = setInterval(refreshAll, 10000); // every 10s
|
||||
setInterval(() => { if (Date.now() - lastActivity > IDLE_RELOAD_MS) location.reload(); }, 30000);
|
||||
loadNetwork();
|
||||
loadHA();
|
||||
checkAgentStatus();
|
||||
|
||||
Reference in New Issue
Block a user