mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: use broadcast channel to handle message update
This commit is contained in:
1 parent
27056c5b69
commit
87b980f87d
7 files changed
+133
-139
No files matched your search
@@ -19,11 +19,8 @@ export default class Sock {
|
||||
this.sock.onmessage = (message) => {
|
||||
if (process.env.NODE_ENV !== 'production') console.log('Sock.onmessage: ', message);
|
||||
const msg = JSON.parse(message.data);
|
||||
if (msg.event === 'auth') {
|
||||
if (msg.error === 'PermissionError' || msg.error === 'PrivilegeError') {
|
||||
this.close();
|
||||
}
|
||||
} else this.onmessage?.(message);
|
||||
if (msg.error === 'PermissionError' || msg.error === 'PrivilegeError') this.close();
|
||||
else this.onmessage?.(message);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user