AssetEntry

View source

Represents one asset slot in an Assets pool.

Each entry holds one optional asset and remains represented when its slot is reserved or empty, allowing the pool to preserve slot identity for Handle values.

Applications normally access assets through Assets rather than constructing entries directly.

Constructor


constructor<T>(asset: T)

View source

Creates a slot entry for an optional asset.

Assets creates entries as it reserves storage for a typed asset family. The reference count and generation start at zero and are updated by the container as the slot is used.

Type Parameters

T

Parameters

NameDescriptionDefault
asset

Asset to store in the slot, if one is available.

—

Properties


asset: T

View source

The asset currently stored in this slot, or undefined while the slot is reserved or empty.

refCount: number

View source

Number of references held for the asset in this slot, including the reference owned by a reserved handle before its asset is filled.

Default: 0

generation: number

View source

Slot generation used to distinguish the current entry from stale handles after the slot is recycled.

Default: 0