Skip to content

charton API


charton API / @chart-on/ui / index / ShellFavorites

Interface: ShellFavorites ​

Defined in: ui/src/favorites.ts:133

Starred drawing tools, shown in the favourites bar and starred in the rail's flyouts.

Properties ​

bar ​

readonly bar: FavoritesBarHandle

Defined in: ui/src/favorites.ts:154

Methods ​

add() ​

add(type): boolean

Defined in: ui/src/favorites.ts:139

Append a tool; returns false, changing nothing, for an unknown type, one already starred or a full list.

Parameters ​

type ​

string

Returns ​

boolean


export() ​

export(): FavoritesEnvelope

Defined in: ui/src/favorites.ts:147

Every kind's favourites and the bar's place, to save elsewhere or move to another browser.

Returns ​

FavoritesEnvelope


get() ​

get(): string[]

Defined in: ui/src/favorites.ts:135

Favourite tool types, in bar order.

Returns ​

string[]


has() ​

has(type): boolean

Defined in: ui/src/favorites.ts:141

Parameters ​

type ​

string

Returns ​

boolean


import() ​

import(data): boolean

Defined in: ui/src/favorites.ts:153

Replace the favourites and the bar's place with an export() result. Kinds and references this chart does not know are kept. Returns false, changing nothing, for data of another version or shape.

Parameters ​

data ​

unknown

Returns ​

boolean


of() ​

of(kind): FavoritesList

Defined in: ui/src/favorites.ts:143

The favourites of any kind, kept in the same record; kind is a non-empty string other than __proto__, constructor or prototype.

Parameters ​

kind ​

string

Returns ​

FavoritesList


on() ​

on<K>(event, listener): () => void

Defined in: ui/src/favorites.ts:156

Subscribe; returns an unsubscribe function.

Type Parameters ​

K ​

K extends keyof FavoritesEvents

Parameters ​

event ​

K

listener ​

(payload) => void

Returns ​

() => void


registerKind() ​

registerKind(kind): () => void

Defined in: ui/src/favorites.ts:145

Set a kind's limit and behaviour, replacing an earlier definition with its id; returns a function that removes it again.

Parameters ​

kind ​

FavoritesKind

Returns ​

() => void


remove() ​

remove(type): void

Defined in: ui/src/favorites.ts:140

Parameters ​

type ​

string

Returns ​

void


set() ​

set(types): void

Defined in: ui/src/favorites.ts:137

Replace the favourites; repeats and unknown tool types not starred already are skipped.

Parameters ​

types ​

readonly string[]

Returns ​

void