API reference

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

C

classMapSpawnSession

@codexo/exojs-tilemap / tilemap / stable

The objects one spawn produced, and their shared lifetime. A session is handed out by import('./MapObjectSpawner').MapObjectSpawner.spawn and owns every result in it. Destroying the session destroys them all; nothing else has to be tracked, and nothing scans the scene to find them again. A session is not reusable - destroy it and spawn again.

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

The objects one spawn produced, and their shared lifetime.

A session is handed out by import('./MapObjectSpawner').MapObjectSpawner.spawn and owns every result in it. Destroying the session destroys them all; nothing else has to be tracked, and nothing scans the scene to find them again.

A session is not reusable - destroy it and spawn again.

Methods3
destroy(): void
Destroy every spawned object, in reverse spawn order. Idempotent; objects still lists what the session held. Reverse order is the contract, not an implementation detail: an object spawned later may have attached itself to an earlier one (a turret to its platform, a light to its lamp), and tearing down the dependent first is the order that never observes a half-destroyed owner.
get(sourceId: string): Result | undefined
The object spawned from the source object with this import('./MapObject').MapObjectDescriptor.id, or undefined when no object with that id spawned anything. Constant time. The ids are the source-stable ones, which is what makes this the hook for savegame restoration: persist the id, look the runtime object back up.
has(sourceId: string): boolean
Whether get would find an object for sourceId.
Properties2
objects: readonly Result[]
The spawned objects in spawn order: object-layer order, then object order within each layer. Objects whose factory returned null are not in here.
destroyed: boolean
Whether destroy has run.
Source