Skip to main content

Class: RiveCache

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

Class to manage the caching and loading of rive files.

Implements

Constructors

Constructor

new RiveCache(): RiveCache

Returns

RiveCache

Properties

assets

assets: Map<string, RiveFile>

Defined in: asset-loading/asset-caches/rive-cache.ts:8

A map of asset paths to their corresponding assets.

Implementation of

AssetCache.assets

Methods

get()

get(path): RiveFile

Defined in: asset-loading/asset-caches/rive-cache.ts:16

Retrieves an asset from the cache.

Parameters

path

string

The path of the rive file to retrieve.

Returns

RiveFile

The cached rive file.

Throws

Will throw an error if the rive file is not found in the cache.

Implementation of

AssetCache.get


getOrLoad()

getOrLoad(path, assetLoader?): Promise<RiveFile>

Defined in: asset-loading/asset-caches/rive-cache.ts:57

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

Parameters

path

string

The path of the rive file to retrieve or load.

assetLoader?

AssetLoadCallback

Returns

Promise<RiveFile>

A promise that resolves to the rive file.

Implementation of

AssetCache.getOrLoad


load()

load(path, assetLoader?): Promise<void>

Defined in: asset-loading/asset-caches/rive-cache.ts:32

Loads an asset from the specified path and caches it.

Parameters

path

string

The path of the rive file to load.

assetLoader?

AssetLoadCallback

Returns

Promise<void>

A promise that resolves when the rive file is loaded and cached.

Throws

Will throw an error if the rive file fails to load.

Implementation of

AssetCache.load