Client: Implement event system (#4)
This commit is contained in:
parent
36ba716ad8
commit
ceca822f97
4 changed files with 81 additions and 7 deletions
|
|
@ -7,4 +7,21 @@ let client;
|
|||
(function() {
|
||||
const wsUri = AppSettings.serverWsUri;
|
||||
client = new Client(wsUri);
|
||||
|
||||
// Test events
|
||||
client.on("initialized", () => {
|
||||
console.log("UI: Connection initialized!");
|
||||
|
||||
// Send a test message
|
||||
client.sendChatMessage("Meow meow! :3");
|
||||
});
|
||||
client.on("disconnected", () => {
|
||||
console.log("UI: Connection closed!");
|
||||
});
|
||||
client.on("connectionError", () => {
|
||||
console.log("UI: Connection error! :()");
|
||||
});
|
||||
client.on("receivedMessage", (msg) => {
|
||||
console.log("UI: Message from '" + msg.from + "', text: '" + msg.text + "'");
|
||||
});
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue