Skip to content

charton API


charton API / @chart-on/ui / templates / IndicatorDefaults

Interface: IndicatorDefaults ​

Defined in: ui/src/templates.ts:73

Per indicator id, the inputs and plot styles new indicators start with, from indicatorDefaults. save and reset are missing when the storage adapter cannot keep templates.

Methods ​

initialState() ​

initialState(def): Promise<Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | null>

Defined in: ui/src/templates.ts:80

The saved default of def's indicator id, or null for none; pass it as the indicator picker's initialState. A default saved for another version of the definition, or with inputs it refuses, gives null with a console warning. Never rejects.

Parameters ​

def ​

IndicatorDef

Returns ​

Promise<Partial<Pick<IndicatorState, "inputs" | "plotStyles">> | null>


reset()? ​

optional reset(type): Promise<void>

Defined in: ui/src/templates.ts:84

Remove the default of indicator id type, so new ones start from the definition's defaults again.

Parameters ​

type ​

string

Returns ​

Promise<void>


save()? ​

optional save(indicator): Promise<void>

Defined in: ui/src/templates.ts:82

Make indicator's inputs and plot styles the default of its indicator id.

Parameters ​

indicator ​

Indicator

Returns ​

Promise<void>