Skip to content

charton API


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

Interface: ActionDefinition ​

Defined in: packages/core/src/actions.ts:24

A command the registry can run.

Properties ​

id ​

id: string

Defined in: packages/core/src/actions.ts:26

Unique id, e.g. 'zoom-in' or 'my-app:save-layout'.


keys? ​

optional keys?: readonly string[]

Defined in: packages/core/src/actions.ts:35

Default shortcuts, e.g. ['Mod+S']. A shortcut is modifiers and a key joined with +: Ctrl, Alt, Shift, Meta (Cmd) and Mod (Ctrl or Cmd, whichever is pressed), then a letter, a digit, a character such as + or -, or a key name such as ArrowLeft, PageUp, Delete, F2.


label ​

label: string | (() => string)

Defined in: packages/core/src/actions.ts:28

Text for menus and tooltips; a function is read each time, e.g. to follow the language.


local? ​

optional local?: boolean

Defined in: packages/core/src/actions.ts:46

Its shortcuts work only while the chart is hovered or focused, even with keyboard.scope: 'global'. Default false.

Methods ​

checked()? ​

optional checked(): boolean

Defined in: packages/core/src/actions.ts:41

For toggles: whether it is on. Leave out for plain commands.

Returns ​

boolean


enabled()? ​

optional enabled(): boolean

Defined in: packages/core/src/actions.ts:39

Whether it can run now. Default: always.

Returns ​

boolean


run() ​

run(): boolean | void

Defined in: packages/core/src/actions.ts:37

Do it. Return false when nothing happened, so a shortcut leaves the key to the page.

Returns ​

boolean | void