@@ -55,7 +55,7 @@ export class Room<State= any> {
55
55
( this . serializer as SchemaSerializer ) . state = new rootSchema ( ) ;
56
56
}
57
57
58
- this . onError ( ( code , message ) => console . warn ( `colyseus.js - onError => (${ code } ) ${ message } ` ) ) ;
58
+ this . onError ( ( code , message ) => console . warn ?. ( `colyseus.js - onError => (${ code } ) ${ message } ` ) ) ;
59
59
this . onLeave ( ( ) => this . removeAllListeners ( ) ) ;
60
60
}
61
61
@@ -73,7 +73,7 @@ export class Room<State= any> {
73
73
connection . events . onmessage = Room . prototype . onMessageCallback . bind ( room ) ;
74
74
connection . events . onclose = function ( e : CloseEvent ) {
75
75
if ( ! room . hasJoined ) {
76
- console . warn ( `Room connection was closed unexpectedly (${ e . code } ): ${ e . reason } ` ) ;
76
+ console . warn ?. ( `Room connection was closed unexpectedly (${ e . code } ): ${ e . reason } ` ) ;
77
77
room . onError . invoke ( e . code , e . reason ) ;
78
78
return ;
79
79
}
@@ -85,7 +85,7 @@ export class Room<State= any> {
85
85
}
86
86
} ;
87
87
connection . events . onerror = function ( e : CloseEvent ) {
88
- console . warn ( `Room, onError (${ e . code } ): ${ e . reason } ` ) ;
88
+ console . warn ?. ( `Room, onError (${ e . code } ): ${ e . reason } ` ) ;
89
89
room . onError . invoke ( e . code , e . reason ) ;
90
90
} ;
91
91
connection . connect ( endpoint ) ;
@@ -288,7 +288,7 @@ export class Room<State= any> {
288
288
this . onMessageHandlers . emit ( '*' , type , message ) ;
289
289
290
290
} else {
291
- console . warn ( `colyseus.js: onMessage() not registered for type '${ type } '.` ) ;
291
+ console . warn ?. ( `colyseus.js: onMessage() not registered for type '${ type } '.` ) ;
292
292
}
293
293
}
294
294
0 commit comments