aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/disconnectButton.ts
diff options
context:
space:
mode:
Diffstat (limited to 'webAO/dom/disconnectButton.ts')
-rw-r--r--webAO/dom/disconnectButton.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/webAO/dom/disconnectButton.ts b/webAO/dom/disconnectButton.ts
new file mode 100644
index 0000000..35daf16
--- /dev/null
+++ b/webAO/dom/disconnectButton.ts
@@ -0,0 +1,12 @@
+import { client } from "../client";
+
+/**
+ * Triggered when the disconnect button in settings is pushed.
+ * Forces a disconnection for testing purposes.
+ */
+export function DisconnectButton() {
+ if (client.serv && client.serv.readyState === WebSocket.OPEN) {
+ client.serv.close();
+ }
+}
+window.DisconnectButton = DisconnectButton;