Leaderboard: refresh() method
Available since
@irtio/room 0.1Hosted roomsirt dev@irtio/testingSelf-hosted room hostThe 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 rooms | irt dev | @irtio/testing | Self-hosted room host | |
|---|---|---|---|---|
refresh() | 0.1 | 0.1 | 0.1 | 0.1 |