mirror of
https://gitlab.com/RemixDev/deemix-webui.git
synced 2024-12-28 18:36:30 +00:00
refactor: CustomWebsocket
This commit is contained in:
parent
cbf3a5c677
commit
efefa7bbf7
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,3 @@
|
|||
import store from '@/store'
|
||||
|
||||
let wasEventListenerAdded = false
|
||||
|
||||
class CustomSocket extends WebSocket {
|
||||
|
@ -8,7 +6,8 @@ class CustomSocket extends WebSocket {
|
|||
}
|
||||
emit(key, data) {
|
||||
if (this.readyState !== WebSocket.OPEN) return false
|
||||
this.send(JSON.stringify({ key: key, data: data }))
|
||||
|
||||
this.send(JSON.stringify({ key, data }))
|
||||
}
|
||||
on(key, cb) {
|
||||
if (!wasEventListenerAdded) {
|
||||
|
|
Loading…
Reference in a new issue