Skip to content

Function: load()

load<T>(key, defaultValue?): T | null

Defined in: save.ts:43

Loads local data.

Type Parameters

T

T

Parameters

key

string

The key of the saved data.

defaultValue?

T

If defined and the key doesn't exist, this value will be returned instead of null.

Returns

T | null

Returns the loaded data, or null if it the key doesn't exist.

Example

ts
const playerState = facile.load('player', {
 name: '',
 score: 0
});