Leaderboard: refresh() method

Available since @irtio/room 0.1Hosted roomsirt dev@irtio/testingSelf-hosted room host

The refresh() method of the Leaderboard interface does nothing: a room caches nothing of a leaderboard, so every top() and around() already reads it from the data service. It’s there so every data handle has a refresh().

Syntax

refresh()

Parameters

None.

Return value

None (undefined).

Examples

Refreshing every data handle alike

// refresh-all.ts
import { defineRoom } from "@irtio/room";

export default defineRoom({
  async onMessage(room, connection, message) {
    if (message !== "refresh") return;
    await room.playerData(connection.player).refresh();
    room.collection("levels").refresh();
    room.leaderboard("points").refresh();
  },
});

See also

Runtime availability

Hosted roomsirt dev@irtio/testingSelf-hosted room host
refresh()0.10.10.10.1