Skip to content
InterfaceStorage & Replay@public

FlxStorageBackend

Replaceable storage backend.

The default implementation uses localStorage; an optional IndexedDB adapter is available for larger data. A NullStorageBackend enables headless testing.

ts
export interface FlxStorageBackend

Methods

close()

ts
close(key: string): void

Release any resources associated with key.

Parameters:

ParameterTypeDescription
keystring-

Returns: void

erase()

ts
erase(key: string): boolean

Erase the record for key. Returns true if a record was present.

Parameters:

ParameterTypeDescription
keystring-

Returns: boolean

read()

ts
read(key: string): Record<string, unknown> | null

Read the data record for key, or null if missing/malformed.

Parameters:

ParameterTypeDescription
keystring-

Returns: Record<string, unknown> | null

write()

ts
write(key: string, data: Record<string, unknown>): FlxSaveResult

Write data for key. Returns a typed success/failure result.

Parameters:

ParameterTypeDescription
keystring-
dataRecord<string, unknown>-

Returns: FlxSaveResult

Released under the MIT License.