API reference

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

C

classChunkStreamer

@codexo/exojs-tilemap / tilemap / stable

Drives TileLayer._adoptChunk/TileLayer._evictChunk calls from a View's position: chunks near the view are requested from a ChunkSource and installed; chunks that scroll far enough away are evicted. Works on both unbounded and bounded layers (a bounded-but-large layer still benefits from not keeping every chunk resident at once) - for a bounded layer, the wanted range is clamped to TileLayer.chunkRange. Touches only the TileLayer data layer - import('./TileLayerNode').TileLayerNode reacts to `_adoptChunk`/`_evictChunk` on its own via a structural listener, so this class has no rendering dependency and no reference to any scene node. Tracks its own resident set (chunks *this instance* has loaded), never touching chunks that predate its attachment or were installed by another source. Tick it from your update loop, like import('./TileAnimator').TileAnimator: ```ts const streamer = new ChunkStreamer(layer, mySource, view); scene.systems.add({ update: () => streamer.update() }); ```

1
props
2
methods
0
events
Import
import { ChunkStreamer } from '@codexo/exojs-tilemap'

Drives TileLayer._adoptChunk/TileLayer._evictChunk calls from a View's position: chunks near the view are requested from a ChunkSource and installed; chunks that scroll far enough away are evicted. Works on both unbounded and bounded layers (a bounded-but-large layer still benefits from not keeping every chunk resident at once) - for a bounded layer, the wanted range is clamped to TileLayer.chunkRange.

Touches only the TileLayer data layer - import('./TileLayerNode').TileLayerNode reacts to `_adoptChunk`/`_evictChunk` on its own via a structural listener, so this class has no rendering dependency and no reference to any scene node.

Tracks its own resident set (chunks *this instance* has loaded), never touching chunks that predate its attachment or were installed by another source.

Tick it from your update loop, like import('./TileAnimator').TileAnimator:

```ts const streamer = new ChunkStreamer(layer, mySource, view); scene.systems.add({ update: () => streamer.update() }); ```

Constructors1
Methods2
destroy(): void
Evict every chunk this instance has loaded and stop responding to update. Does not affect chunks predating attachment or installed by another source. Idempotent. Does not destroy the ChunkSource passed to the constructor: this class only reads from it and never took ownership. A source with its own destroy() (e.g. import('./WorkerSampledChunkSource').createWorkerSampledChunkSource's, which tears down a real Worker) must be destroyed separately by whoever created it.
update(): void
Recompute the wanted chunk set from the view's current position; evict own-resident chunks that fell outside unloadRadius, then request chunks newly inside loadRadius. The very first call loads the entire initial wanted set unbudgeted; every later call is capped at ChunkStreamerOptions.maxChunkLoadsPerFrame. No-op once destroyed.
Properties1
residentCount: number
Number of chunks this instance currently has resident in the layer.
Source