Skip to main content
Version: 3.0.0

Local events

Things happen all the time not just on the server side. They can be tracked, with EventListeners.

Registering an EventListener

The first parametes is the event's name, the second is it's callback function. You don't have to worry about registering a function with wrong parameters. All of them are staticly typed.

client.addEventListener("onStatusChange", (newStauts: WSStatus) =>{
console.log(newStauts); //Enum
});

OR

This will only get executed once.

client.onceEventListener("onStatusChange", (newStauts: WSStatus) => {
console.log(newStauts); //Enum
});

Currently available event types

  • onStatusChange
    • Runs when the connection status changes
  • onMessageRecieved
    • Runs after the client processes a newly recieved message
  • onRawMessageRecieved
    • Runs before the client processes a newly recieved message
  • onCookieSync
    • Runs after the client successfully syncs cookies with the server