getState

Useful for reading important game state values, like the current score or winner.

Signature

function getState(key: string): any

Parameters

NameTypeDescription
keystringThe state key to retrieve.

Returns

any

Usage

const winnerId = getState('winner');
console.log(`Winner is ${winnerId}`);