ShyyTAUI/src/lib/taDocs/2-stateManager-allFunctions.md

1.9 KiB

All of the methods of the StateManager

Below you can find a table that shows all of the methods of the stateManager.

taClient.stateManager. (method) Purpose and functionality Is Async
emit() Emit a custom event. Only use this if you know what you are doing. True
getKnownServers() Get the known servers which have been sent in the connect state. This is a cached list. False
getMatch() Get the details of a match. False
getMatches() Get an array of all of the matches in a tournament. False
getQualifier() Get the details of a qualifier event. False
getQualifiers() Get an array of all of the qualifiers in a tournament. False
getSelfGuid() Get the .guid property of the currently logged in user or bot token. False
getTournament() Get the information about a tournament. False
getTournaments() Get an array of all of the tournaments of a Core Server False
getUser() Get all of the details of a user in a tournament. False
getUsers() Get an array of all of the users in a tournament. False
handlePacket() Handle the response to a packet sent to you by the TA Core Server. Only use if you know what you are doing. False
on() Standard listener for the taClient. This is how real time score can be subscribed to. False
once() This is essentially the same as taClient.stateManager.on() except it unsubscribes after the first event. False
removeListener() Unsibscribe from the events that you have started to listen to. False

How to listen, what is the general schema?

Generally, the format is just:

taClient.stateManager.on('eventType', () => {
    // callback function
})

or

async function handleEvent(params) {
    // code here
}

taClient.stateManager.on('eventType', handleEvent);

All of the event types and how to handle them are within this State Manager section.