mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Propagate incognito status change to server
This commit is contained in:
parent
321a91910f
commit
7f0d723e69
@ -72,6 +72,14 @@ class UserWebSocket {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current connection status with the server
|
||||
*/
|
||||
static get IsConnected() {
|
||||
return this.hasOwnProperty("ws")
|
||||
&& this.ws.readyState == WebSocket.OPEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles websocket errors
|
||||
*/
|
||||
@ -211,3 +219,10 @@ class UserWebSocket {
|
||||
queue.res(msg.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Register some events
|
||||
document.addEventListener("incognitoStatusChanged", (e) => {
|
||||
if(UserWebSocket.IsConnected)
|
||||
ws("$main/set_incognito", {enable: e.detail.enabled})
|
||||
})
|
Loading…
Reference in New Issue
Block a user