Skip to content

charton API


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

Interface: AutosaveOptions ​

Defined in: packages/core/src/storage/autosave.ts:8

Options for autosave: the debounce delay, which changes save, how the layout is serialized and stored, error handling, and the flush-on-leave target.

Properties ​

delayMs? ​

optional delayMs?: number

Defined in: packages/core/src/storage/autosave.ts:10

Wait this long after the last change before saving. Default 1000.


flushTarget? ​

optional flushTarget?: EventTarget | null

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

Where to listen for pagehide, which saves a pending change at once so the last edit is not lost. Default globalThis; null turns it off.


include? ​

optional include?: readonly StateChangeReason[]

Defined in: packages/core/src/storage/autosave.ts:12

Changes that trigger a save. Default every reason but 'viewport'.


onError? ​

optional onError?: (error) => void

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

A save threw or rejected. Default logs it.

Parameters ​

error ​

unknown

Returns ​

void


save ​

save: (layout, reasons) => void | Promise<void>

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

Store the layout. reasons lists what changed since the last save.

Parameters ​

layout ​

ChartLayout

reasons ​

StateChangeReason[]

Returns ​

void | Promise<void>


serialize? ​

optional serialize?: LayoutSerializeOptions

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

Passed to serializeLayout, e.g. { drawings: false } when drawings are kept per symbol.