Skip to main content

Class: LocalStorageAnchorStore

Defined in: src/world/anchors/LocalStorageAnchorStore.ts:33

Persists anchor handles in browser local storage.

Every operation degrades to a no-op rather than throwing: a missing or full store should cost the caller its persistence, not its session.

Implements

Constructors

Constructor

new LocalStorageAnchorStore(key, maxRecords, storage?): LocalStorageAnchorStore

Defined in: src/world/anchors/LocalStorageAnchorStore.ts:43

Parameters

key

string

Storage key to read and write.

maxRecords

number

Cap on saved records; oldest are evicted first.

storage?

Backing storage. Omit to use localStorage; pass null to disable persistence entirely. null is distinct from omission so callers can opt out explicitly instead of relying on a default.

AnchorStorageLike | null

Returns

LocalStorageAnchorStore

Methods

clear()

clear(): void

Defined in: src/world/anchors/LocalStorageAnchorStore.ts:109

Removes every saved record.

Returns

void

Implementation of

AnchorStore.clear


load()

load(): AnchorRecord[]

Defined in: src/world/anchors/LocalStorageAnchorStore.ts:56

Reads every saved record.

Returns

AnchorRecord[]

Saved records, oldest first, or an empty array.

Implementation of

AnchorStore.load


remove()

remove(uuid): void

Defined in: src/world/anchors/LocalStorageAnchorStore.ts:104

Removes a single record.

Parameters

uuid

string

Handle of the record to remove.

Returns

void

Implementation of

AnchorStore.remove


save()

save(record): boolean

Defined in: src/world/anchors/LocalStorageAnchorStore.ts:84

Saves a record, replacing any existing entry with the same uuid.

Parameters

record

AnchorRecord

The record to save.

Returns

boolean

Whether the record was committed.

Implementation of

AnchorStore.save