mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 18:08:50 +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
|
||||
*/
|
||||
@ -210,4 +218,11 @@ class UserWebSocket {
|
||||
// It is a success
|
||||
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