API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classWebStorageStore

@codexo/exojs / assets / stable

KeyValueStore over the Web Storage API (`localStorage` or `sessionStorage`). Web Storage holds only strings, so values are JSON-serialized on write and parsed on read - they must be JSON-serializable (**no** Blobs/`ArrayBuffer`s; use IndexedDbKeyValueStore for those). The backend is synchronous with a small (~5-10 MB) quota; the async interface wraps it so call sites stay uniform across stores. This is the moral successor of the former `JsonStore`: JSON is intrinsic here because the backend can only hold strings.

0
props
5
methods
0
events
Import
import { WebStorageStore } from '@codexo/exojs'

KeyValueStore over the Web Storage API (`localStorage` or `sessionStorage`).

Web Storage holds only strings, so values are JSON-serialized on write and parsed on read - they must be JSON-serializable (**no** Blobs/`ArrayBuffer`s; use IndexedDbKeyValueStore for those). The backend is synchronous with a small (~5-10 MB) quota; the async interface wraps it so call sites stay uniform across stores. This is the moral successor of the former `JsonStore`: JSON is intrinsic here because the backend can only hold strings.

Constructors1
new(storage: Storage, options: WebStorageStoreOptionsConstruction options for WebStorageStore.): WebStorageStore
Wrap a Storage object (localStorage/sessionStorage, or a compatible polyfill).
Methods5
clear(): Promise<boolean>
Remove every entry owned by this store. Resolves true on success.
delete(key: string): Promise<boolean>
Remove the entry at key. Resolves true if one existed and was removed.
get(key: string): Promise<T | null>
Read the value at key, or null when absent.
has(key: string): Promise<boolean>
Whether an entry exists at key.
set(key: string, value: unknown): Promise<void>
Write value at key, replacing any existing entry.
Source