mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
update
This commit is contained in:
1 parent
59a0865157
commit
7f33100132
1 file changed
+4
-4
@@ -1,8 +1,8 @@
|
||||
import io from 'socket.io-client'
|
||||
import { io, Socket } from 'socket.io-client'
|
||||
|
||||
class SocketWrapper {
|
||||
socket: any
|
||||
listeners: any
|
||||
socket: Socket | null
|
||||
listeners: { event: any; callback: any }[]
|
||||
constructor() {
|
||||
this.socket = null
|
||||
this.listeners = []
|
||||
@@ -40,7 +40,7 @@ class SocketWrapper {
|
||||
bindListeners() {
|
||||
this.listeners.forEach(
|
||||
({ event, callback }: { event: any; callback: any }) => {
|
||||
this.socket.on(event, callback)
|
||||
if (this.socket !== null) this.socket.on(event, callback)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user