Close signature.html when aster is unloaded

This commit is contained in:
2026-01-19 14:40:05 +00:00
parent 6fca4087da
commit 080a264271

View File

@@ -1260,5 +1260,32 @@ window.updateDynamicTranslationsCustom = function() {
} }
}; };
// Send discard signal when page is closed
window.addEventListener('beforeunload', () => {
if (ws && ws.readyState === WebSocket.OPEN) {
try {
ws.send(JSON.stringify({
type: 'discard'
}));
console.log('Discard-Signal gesendet beim Schließen der Seite');
} catch (error) {
console.error('Fehler beim Senden des Discard-Signals:', error);
}
}
});
// Also send on page unload (fallback)
window.addEventListener('unload', () => {
if (ws && ws.readyState === WebSocket.OPEN) {
try {
ws.send(JSON.stringify({
type: 'discard'
}));
} catch (error) {
// Ignore errors during unload
}
}
});
// Connect WebSocket on load // Connect WebSocket on load
connectWebSocket(); connectWebSocket();