charton API / @chart-on/core / index / createLocalStorageAdapter
Function: createLocalStorageAdapter()
createLocalStorageAdapter(
options?):LocalStorageAdapter
Defined in: packages/core/src/storage/local.ts:68
Chart state in the browser's localStorage (or any store with the same three methods). Every access is guarded: private mode, blocked storage and a full quota never break the chart. Unreadable entries read as null and are removed.
Keys: <prefix>drawings:<key>, <prefix>layouts (the index), <prefix>layout:<id>, <prefix>templates:<kind> (every template of the kind, names and scopes kept exactly), <prefix>settings:<key>.
Parameters
options?
LocalStorageAdapterOptions = {}
Returns
Example
ts
const storage = createLocalStorageAdapter({ prefix: 'my-app:' });
perSymbolDrawings(chart, storage);
const last = await loadLastLayout(chart, storage);
if (!last) await chart.setSymbol('ABC', '1d');