API reference

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

C

classDisposalScope

@codexo/exojs / core / stable

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.

2
props
4
methods
0
events
Import
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.

Constructors 1
new(): DisposalScope
Methods 4
destroy(): void
has(item: Destroyable): boolean
track(item: T): T
untrack(item: Destroyable): boolean
Properties 2
disposed: boolean
size: number
Source