mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-13 22:32:09 +08:00
22 lines
608 B
TypeScript
22 lines
608 B
TypeScript
import { registerListActionEvent } from '../../../utils'
|
|
|
|
let unregisterLocalListAction: (() => void) | null
|
|
|
|
export const registerEvent = (socket: LX.Sync.Socket) => {
|
|
// socket = _socket
|
|
// socket.onClose(() => {
|
|
// unregisterLocalListAction?.()
|
|
// unregisterLocalListAction = null
|
|
// })
|
|
unregisterEvent()
|
|
unregisterLocalListAction = registerListActionEvent((action) => {
|
|
if (!socket.moduleReadys?.list) return
|
|
void socket.remoteQueueList.onListSyncAction(action)
|
|
})
|
|
}
|
|
|
|
export const unregisterEvent = () => {
|
|
unregisterLocalListAction?.()
|
|
unregisterLocalListAction = null
|
|
}
|