Skip to content

@modoki/engine / index / LocalStorageBackend

Class: LocalStorageBackend

Web backend. Each key → its own localStorage entry; setItem replaces the value wholesale (atomic — a reader never sees a torn string). set may throw QuotaExceededError; the write pipeline in playerPrefs.ts catches it and re-queues.

Implements

Constructors

Constructor

new LocalStorageBackend(): LocalStorageBackend

Returns

LocalStorageBackend

Storage

getAll()

getAll(prefix): Promise<Record<string, string>>

All entries whose full key starts with prefix, as { fullKey: envelopeString }.

Parameters

prefix

string

Returns

Promise<Record<string, string>>

Implementation of

PrefsBackend.getAll


remove()

remove(fullKey): Promise<void>

Remove one entry.

Parameters

fullKey

string

Returns

Promise<void>

Implementation of

PrefsBackend.remove


set()

set(fullKey, value): Promise<void>

Write one entry atomically (full key → envelope string).

Parameters

fullKey

string

value

string

Returns

Promise<void>

Implementation of

PrefsBackend.set

Built with Modoki.