DocumentData
One JSON value a plugin keeps in the open model. It is saved in .modl files and
reverts with undo and redo; a new or opened document starts with that document’s
value, or none. Values are stored as JSON.stringify writes them, up to 1 MiB.
const count = context.documentData.get() ?? 0;context.documentData.set(count + 1);Methods
Section titled “Methods”get<
T>():T|undefined
Returns a copy of the plugin’s value in the open model, or undefined when it has none.
Type Parameters
Section titled “Type Parameters”T = unknown
Returns
Section titled “Returns”T | undefined
set(
value):void
Stores the plugin’s value in the open model; undefined removes it. Inside
Model.operation the change joins that operation; otherwise it is an undo
step of its own. Storing the current value again adds no undo step.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”void