Skip to content

Commit 9e6a5dc

Browse files
committed
task update
1 parent 07585ef commit 9e6a5dc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/web/store/room.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ export const actions: ActionTree<RoomState, RootState> = {
4646

4747
if ((window as any).subscription){
4848
try {
49-
(window as any).subscription[0]();
49+
(window as any).subscription.removeAllListeners();
50+
(window as any).subscription = null;
5051
console.info("Cleared subscription");
5152
} catch (e){
52-
53+
5354
}
5455
(window as any).subscription = null;
5556
}
@@ -59,7 +60,7 @@ export const actions: ActionTree<RoomState, RootState> = {
5960
(window as any).subscriptions[room.id] = room;
6061
rooms[id] = room;
6162
console.info("Subscribed to room: ", room, (window as any).subscriptions);
62-
(window as any).subscription = room.onStateChange(async (state) => {
63+
room.onStateChange(async (state) => {
6364
console.log("<--", {state});
6465
(window as any).state = state;
6566
const model = await Room.query().where('roomId', id).first()
@@ -71,7 +72,9 @@ export const actions: ActionTree<RoomState, RootState> = {
7172
...state.toJSON(),
7273
},
7374
})
74-
})
75+
});
76+
(window as any).subscription = room;
77+
7578
//}, 300);
7679
},
7780
async join(context: any, roomId) {

0 commit comments

Comments
 (0)