File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments