defineLeaderboards
defineLeaderboards<
Boards>(boards):Leaderboards<Boards>
Declares a game’s leaderboards, at module scope: each board under its
camelCase key, which is its identity once published. A board with no key
and no world is its own handle; a keyed board, or one whose parent is a
world, names its handles with for. Throws for a key that is not
camelCase and for a board the platform would refuse, naming the fix.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Boards extends Record<string, LeaderboardOptions> |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
boards |
Boards |
Returns
Section titled “Returns”Leaderboards<Boards>
Example
Section titled “Example”export const leaderboards = defineLeaderboards({ fastestLap: { name: "Fastest lap", writtenBy: "room", keyed: true, sortOrder: "ascending", unit: "milliseconds", update: "best", period: "weekly", },});submitScore(step, leaderboards.fastestLap.for("sunset-loop"), player, 71400);