TeaWeb/web/app/UnloadHandler.ts

12 lines
468 B
TypeScript
Raw Normal View History

2020-08-22 17:50:38 +02:00
import {Settings, settings} from "tc-shared/settings";
2020-09-24 11:24:31 +02:00
import {server_connections} from "tc-shared/ConnectionManager";
2020-08-22 17:50:38 +02:00
window.addEventListener("beforeunload", event => {
if(settings.static(Settings.KEY_DISABLE_UNLOAD_DIALOG))
return;
const active_connections = server_connections.all_connections().filter(e => e.connected);
if(active_connections.length == 0) return;
event.returnValue = "Are you really sure?<br>You're still connected!";
});