EditorAtom
See source codeAn Atom that is scoped to the lifetime of an Editor.
This is useful for storing UI state for tldraw applications. Keeping state scoped to an editor instead of stored in a global atom can prevent issues with state being shared between editors when navigating between pages, or when multiple editor instances are used on the same page.
class EditorAtom<T> {}Constructor
Constructs a new instance of the EditorAtom class
Parameters
| Name | Description |
|---|---|
| |
| |
Methods
get( )
get(editor: Editor): TParameters
| Name | Description |
|---|---|
|
Returns
TgetAtom( )
Parameters
| Name | Description |
|---|---|
|
Returns
Atom<T>set( )
set(editor: Editor, state: T): TParameters
| Name | Description |
|---|---|
| |
| |
Returns
Tupdate( )
update(editor: Editor, update: (state: T) => T): TParameters
| Name | Description |
|---|---|
| |
| |
Returns
TPrev
EditorNext
Ellipse2d