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): T
Parameters
Name | Description |
---|---|
|
Returns
T
getAtom()
Parameters
Name | Description |
---|---|
|
Returns
Atom<T>
set()
set(editor: Editor, state: T): T
Parameters
Name | Description |
---|---|
| |
|
|
Returns
T
update()
update(editor: Editor, update: (state: T) => T): T
Parameters
Name | Description |
---|---|
| |
|
|
Returns
T
Prev
EditorNext
Ellipse2d