Stable state before Final Polish optimizations

This commit is contained in:
Timo
2026-04-22 08:56:52 +02:00
parent d558e9d9c4
commit 5cfc9d4047
7 changed files with 166 additions and 65 deletions
+11 -2
View File
@@ -145,7 +145,8 @@
}
// Heartbeat
setInterval(() => {
let heartbeatErrorCount = 0;
const heartbeatInterval = setInterval(() => {
const video = findVideo();
if (video) {
chrome.runtime.sendMessage({
@@ -154,7 +155,15 @@
playbackState: video.paused ? 'paused' : 'playing',
currentTime: video.currentTime
}
}).catch(() => {});
}).catch(err => {
if (err.message.includes('Extension context invalidated')) {
heartbeatErrorCount++;
if (heartbeatErrorCount === 1) {
console.warn('KoalaSync: Extension reloaded. Please refresh the page if sync stops working.');
}
clearInterval(heartbeatInterval);
}
});
}
}, 15000);