Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

readHeldWorld

readHeldWorld(world): HeldWorld | null

The persistent world this page or room holds, as the directory names it: its id, name, owner, region, settings and listing; null in a room that holds none, in a game played alone that keeps no worlds, and before the platform’s first answer. Outside the app, as under spawnite dev, a game played alone that keeps worlds holds the stand-in world dev. It reads the same in the room and on each page, where useHeldWorld is its hook. The world it takes is the simulation, the room’s or the page’s. Every player in the room can read it, its settings included, so a secret belongs in the world’s record.

Parameter Type
world World

HeldWorld | null

const held = readHeldWorld(world);
if (held?.isCreatorOwned) allowVisitorsToBuild(step);