Skip to content
ClassStorage & Replay@public

LocalStorageBackend

localStorage-backed storage implementation.

Keys are namespaced as flixel:{name} to avoid collisions with other web applications. Quota failures are detected via DOMException and surfaced through the FlxSaveResult type. Malformed stored JSON returns null and logs a console warning rather than throwing.

ts
export declare class LocalStorageBackend implements FlxStorageBackend

Methods

close()

ts
close(key: string): void

Parameters:

ParameterTypeDescription
keystring-

Returns: void

erase()

ts
erase(key: string): boolean

Parameters:

ParameterTypeDescription
keystring-

Returns: boolean

read()

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

Parameters:

ParameterTypeDescription
keystring-

Returns: Record<string, unknown> | null

write()

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

Parameters:

ParameterTypeDescription
keystring-
dataRecord<string, unknown>-

Returns: FlxSaveResult

Released under the MIT License.