API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classDisposalScope
Ownership container for Destroyable resources. Items registered with track are destroyed in reverse registration order when the scope itself is destroyed — the spine of ExoJS's ownership-driven cleanup. A Scene owns one (exposed via `Scene.track`); an `Application` owns one for app-scoped services. `track` is idempotent and returns its argument for fluent capture: ```ts const world = scope.track(new PhysicsWorld()); ``` destroy is idempotent and tolerant: every tracked item's `destroy()` is attempted even if an earlier one throws, so a single failure cannot leak the rest. In development the collected errors are rethrown as an `AggregateError` once teardown completes; in production they are swallowed. A `DisposalScope` is itself Destroyable, so scopes can nest.
import { DisposalScope } from '@codexo/exojs' Ownership container for Destroyable resources. Items registered with track are destroyed in reverse registration order when the scope itself is destroyed — the spine of ExoJS's ownership-driven cleanup. A Scene owns one (exposed via `Scene.track`); an `Application` owns one for app-scoped services.
`track` is idempotent and returns its argument for fluent capture:
```ts const world = scope.track(new PhysicsWorld()); ```
destroy is idempotent and tolerant: every tracked item's `destroy()` is attempted even if an earlier one throws, so a single failure cannot leak the rest. In development the collected errors are rethrown as an `AggregateError` once teardown completes; in production they are swallowed.
A `DisposalScope` is itself Destroyable, so scopes can nest.
new(): DisposalScope destroy(): void has(item: Destroyable): boolean track(item: T): T untrack(item: Destroyable): boolean disposed: boolean size: number