Skip to main content

Interface: AssetCache<TItem>

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

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

Template

The type of arguments for loading assets.

Type Parameters

TItem

TItem

The type of asset being cached.

Properties

assets

assets: Map<string, TItem>

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

A map of asset keys to their corresponding assets.


get()

get: (key) => TItem

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

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:32

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:25

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.