Class: AssetRegistry<T>
Defined in: asset-loading/asset-registry.ts:5
A registry for assets that allows for registration of assets with string IDs and retrieval of numeric IDs. This is useful for efficient storage and retrieval of assets while still allowing for human-readable identifiers.
Type Parameters
T
T
Constructors
Constructor
new AssetRegistry<
T>():AssetRegistry<T>
Returns
AssetRegistry<T>
Methods
getDirect()
getDirect(
numericId):T
Defined in: asset-loading/asset-registry.ts:52
Retrieves an asset directly by its numeric ID.
Parameters
numericId
number
The numeric ID of the asset to retrieve.
Returns
T
The asset associated with the provided numeric ID.
Throws
Error if the numeric ID is out of bounds.
getId()
getId(
stringId):number
Defined in: asset-loading/asset-registry.ts:35
Retrieves the numeric ID associated with a given string ID.
Parameters
stringId
string
The string ID of the asset to retrieve.
Returns
number
The numeric ID associated with the provided string ID.
Throws
Error if the string ID is not found in the registry.
register()
register(
stringId,item):number
Defined in: asset-loading/asset-registry.ts:15
Registers an asset with a string ID and returns its numeric ID.
Parameters
stringId
string
The human-readable string ID for the asset.
item
T
The asset to register.
Returns
number
The numeric ID assigned to the registered asset.
Throws
Error if the string ID is already registered in the registry.