Skip to content

Commit

Permalink
prevent console.warn errors in decentraland. bump version.
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Sep 21, 2023
1 parent 9cf6338 commit c16c1e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "colyseus.js",
"version": "0.15.13",
"version": "0.15.14",
"description": "Colyseus Multiplayer SDK for JavaScript/TypeScript",
"author": "Endel Dreyer",
"license": "MIT",
Expand Down
8 changes: 4 additions & 4 deletions src/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class Room<State= any> {
(this.serializer as SchemaSerializer).state = new rootSchema();
}

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

Expand All @@ -73,7 +73,7 @@ export class Room<State= any> {
connection.events.onmessage = Room.prototype.onMessageCallback.bind(room);
connection.events.onclose = function (e: CloseEvent) {
if (!room.hasJoined) {
console.warn(`Room connection was closed unexpectedly (${e.code}): ${e.reason}`);
console.warn?.(`Room connection was closed unexpectedly (${e.code}): ${e.reason}`);
room.onError.invoke(e.code, e.reason);
return;
}
Expand All @@ -85,7 +85,7 @@ export class Room<State= any> {
}
};
connection.events.onerror = function (e: CloseEvent) {
console.warn(`Room, onError (${e.code}): ${e.reason}`);
console.warn?.(`Room, onError (${e.code}): ${e.reason}`);
room.onError.invoke(e.code, e.reason);
};
connection.connect(endpoint);
Expand Down Expand Up @@ -288,7 +288,7 @@ export class Room<State= any> {
this.onMessageHandlers.emit('*', type, message);

} else {
console.warn(`colyseus.js: onMessage() not registered for type '${type}'.`);
console.warn?.(`colyseus.js: onMessage() not registered for type '${type}'.`);
}
}

Expand Down

0 comments on commit c16c1e1

Please sign in to comment.