API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classPrefab
A reusable, data-driven template captured from a configured scene-graph subtree. Capture once with Prefab.from; stamp out independent copies with instantiate as many times as needed - no re-serialization per instance. A prefab holds the same **data, not behaviour** a scene serializer captures (structure, transforms, visuals, asset references). Re-attach behaviour (signal handlers, systems) in code after instantiate. ```ts const coin = Prefab.from(buildCoin(), loader); for (let i = 0; i < 10; i++) { const node = coin.instantiate(loader); node.setPosition(i * 32, 0); scene.addChild(node); } ```
import { Prefab } from '@codexo/exojs'A reusable, data-driven template captured from a configured scene-graph subtree. Capture once with Prefab.from; stamp out independent copies with instantiate as many times as needed - no re-serialization per instance.
A prefab holds the same **data, not behaviour** a scene serializer captures (structure, transforms, visuals, asset references). Re-attach behaviour (signal handlers, systems) in code after instantiate.
```ts const coin = Prefab.from(buildCoin(), loader); for (let i = 0; i < 10; i++) { const node = coin.instantiate(loader); node.setPosition(i * 32, 0); scene.addChild(node); } ```
instantiate(loader: Loader | null, registry?: SerializationRegistryBidirectional name ↔ constructor ↔ NodeSerializer registry backing the scene serializer. Serialize resolves a node to its serializer by walking the constructor…): SceneNodeTransform-bearing leaf in the scene-graph hierarchy. Carries position, rotation, scale, skew and origin. Implements Collidable so any node can participate dire…from(node: SceneNodeTransform-bearing leaf in the scene-graph hierarchy. Carries position, rotation, scale, skew and origin. Implements Collidable so any node can participate dire…, loader: Loader | null, registry?: SerializationRegistryBidirectional name ↔ constructor ↔ NodeSerializer registry backing the scene serializer. Serialize resolves a node to its serializer by walking the constructor…): PrefabfromJSON(document: unknown): Prefab