Close signature.html when aster is unloaded
This commit is contained in:
27
js/master.js
27
js/master.js
@@ -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
|
||||
connectWebSocket();
|
||||
|
||||
Reference in New Issue
Block a user