Skip to main content

Interface: AssetCache<TItem>

Defined in: asset-loading/asset-cache.ts:6

Interface for an asset cache that manages loading and retrieving assets.

Type Parameters

TItem

TItem

The type of asset being cached.

Properties

assets

assets: Map<string, TItem>

Defined in: asset-loading/asset-cache.ts:10

A map of asset keys to their corresponding assets.


get

get: (key) => TItem

Defined in: asset-loading/asset-cache.ts:17

Retrieves an asset from the cache.

Parameters

key

string

The key of the asset to retrieve.

Returns

TItem

The cached asset.


getOrLoad

getOrLoad: (key) => Promise<TItem>

Defined in: asset-loading/asset-cache.ts:31

Retrieves an asset from the cache if it exists, otherwise loads and caches it.

Parameters

key

string

The key of the asset to retrieve or load.

Returns

Promise<TItem>

A promise that resolves to the asset.


load

load: (key) => Promise<void>

Defined in: asset-loading/asset-cache.ts:24

Loads an asset from the specified key and caches it.

Parameters

key

string

The key of the asset to load.

Returns

Promise<void>

A promise that resolves when the asset is loaded and cached.