Skip to content

Commit c16c1e1

Browse files
committed
prevent console.warn errors in decentraland. bump version.
1 parent 9cf6338 commit c16c1e1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "colyseus.js",
3-
"version": "0.15.13",
3+
"version": "0.15.14",
44
"description": "Colyseus Multiplayer SDK for JavaScript/TypeScript",
55
"author": "Endel Dreyer",
66
"license": "MIT",

src/Room.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class Room<State= any> {
5555
(this.serializer as SchemaSerializer).state = new rootSchema();
5656
}
5757

58-
this.onError((code, message) => console.warn(`colyseus.js - onError => (${code}) ${message}`));
58+
this.onError((code, message) => console.warn?.(`colyseus.js - onError => (${code}) ${message}`));
5959
this.onLeave(() => this.removeAllListeners());
6060
}
6161

@@ -73,7 +73,7 @@ export class Room<State= any> {
7373
connection.events.onmessage = Room.prototype.onMessageCallback.bind(room);
7474
connection.events.onclose = function (e: CloseEvent) {
7575
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}`);
7777
room.onError.invoke(e.code, e.reason);
7878
return;
7979
}
@@ -85,7 +85,7 @@ export class Room<State= any> {
8585
}
8686
};
8787
connection.events.onerror = function (e: CloseEvent) {
88-
console.warn(`Room, onError (${e.code}): ${e.reason}`);
88+
console.warn?.(`Room, onError (${e.code}): ${e.reason}`);
8989
room.onError.invoke(e.code, e.reason);
9090
};
9191
connection.connect(endpoint);
@@ -288,7 +288,7 @@ export class Room<State= any> {
288288
this.onMessageHandlers.emit('*', type, message);
289289

290290
} else {
291-
console.warn(`colyseus.js: onMessage() not registered for type '${type}'.`);
291+
console.warn?.(`colyseus.js: onMessage() not registered for type '${type}'.`);
292292
}
293293
}
294294

0 commit comments

Comments
 (0)