API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classMapWorldRuntime

@codexo/exojs-tilemap / tilemap / stable

The live side of a MapWorld: loads and unloads levels on demand, each with its own asset scope and its own lifetime. ExoJS provides the mechanism, not the streaming policy. Nothing here watches a camera or guesses a radius: game code reads MapWorld.getNeighbours / MapWorld.getLevelsInBounds and calls loadLevel and unloadLevel when it decides to. Scope layout - the runtime owns everything below its own scope and nothing above it: ```text scene.loader (given to the runtime, never destroyed by it) └─ world (the runtime's own scope) ├─ level:forest └─ level:cave ```

4
props
7
methods
0
events
Import
import { MapWorldRuntime } from '@codexo/exojs-tilemap'

The live side of a MapWorld: loads and unloads levels on demand, each with its own asset scope and its own lifetime.

ExoJS provides the mechanism, not the streaming policy. Nothing here watches a camera or guesses a radius: game code reads MapWorld.getNeighbours / MapWorld.getLevelsInBounds and calls loadLevel and unloadLevel when it decides to.

Scope layout - the runtime owns everything below its own scope and nothing above it:

```text scene.loader (given to the runtime, never destroyed by it) └─ world (the runtime's own scope) ├─ level:forest └─ level:cave ```

Constructors1
Methods7
destroy(): void
Cancel every load in flight, unload every loaded level in reverse load order, and release the runtime's own scope. Idempotent. The scope the runtime was constructed with is left alone - it belongs to whoever passed it in.
isLoaded(id: string): boolean
Whether the level is loaded. A load still in flight does not count as loaded.
isLoading(id: string): boolean
Whether a load for this level is currently running.
Load a level, or return the one already loaded. At most one runtime exists per level id. Calling this while the level is loaded resolves to that runtime, and calling it while a load is in flight joins that load rather than starting a second one. **Options belong to the call that actually starts the load** - a joining call's spawner, context and signal are not applied, because the level being produced is the one the first call asked for. Pass { spawner, context } to spawn the level's objects as part of the load, or just { signal } to load a level without spawning anything. A failed or aborted load leaves nothing behind: the map, anything the spawner created, and the level's asset claims are all released before the rejection surfaces, and the level can be loaded again.
Load a level, or return the one already loaded. At most one runtime exists per level id. Calling this while the level is loaded resolves to that runtime, and calling it while a load is in flight joins that load rather than starting a second one. **Options belong to the call that actually starts the load** - a joining call's spawner, context and signal are not applied, because the level being produced is the one the first call asked for. Pass { spawner, context } to spawn the level's objects as part of the load, or just { signal } to load a level without spawning anything. A failed or aborted load leaves nothing behind: the map, anything the spawner created, and the level's asset claims are all released before the rejection surfaces, and the level can be loaded again.
unloadLevel(id: string): boolean
Unload a level, or cancel its load when one is in flight. Returns whether there was anything to unload. A cancelled load rejects with an AbortError for whoever started it, and the level is immediately loadable again - a loadLevel issued in the same turn starts a fresh load rather than joining the one just cancelled.
Properties4
destroyed: boolean
Whether destroy has run.
Source