mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30: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 {
|
class SocketWrapper {
|
||||||
socket: any
|
socket: Socket | null
|
||||||
listeners: any
|
listeners: { event: any; callback: any }[]
|
||||||
constructor() {
|
constructor() {
|
||||||
this.socket = null
|
this.socket = null
|
||||||
this.listeners = []
|
this.listeners = []
|
||||||
@@ -40,7 +40,7 @@ class SocketWrapper {
|
|||||||
bindListeners() {
|
bindListeners() {
|
||||||
this.listeners.forEach(
|
this.listeners.forEach(
|
||||||
({ event, callback }: { event: any; callback: any }) => {
|
({ 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