Skip to content

charton API


charton API / @chart-on/core / index / LocalStorageAdapterOptions

Interface: LocalStorageAdapterOptions ​

Defined in: packages/core/src/storage/local.ts:14

Options for createLocalStorageAdapter: the key prefix, the Web Storage object to use, and an error hook.

Properties ​

onError? ​

optional onError?: (error, key) => void

Defined in: packages/core/src/storage/local.ts:23

Called when a read or write fails (blocked storage, quota full) or a corrupt entry is dropped. Failures never throw; without this they are silent.

Parameters ​

error ​

unknown

key ​

string

Returns ​

void


prefix? ​

optional prefix?: string

Defined in: packages/core/src/storage/local.ts:16

Prepended to every key. Default 'charton:'; give each app or chart on a domain its own.


storage? ​

optional storage?: KeyValueStorage

Defined in: packages/core/src/storage/local.ts:18

The store to use. Default localStorage; sessionStorage or an in-memory stand-in also work.