Readonly
apiPatch builder for the local changes.
Readonly
modelModel instance on which the API operates.
Readonly
onEmitted before local changes through model.api
are applied.
Readonly
onEmitted before a patch is applied using model.applyPatch()
.
Readonly
onEmitted before the model is reset, using the .reset()
method.
Readonly
onEmitted before a transaction is started.
Readonly
onEmitted when the model changes. Combines onReset
, onPatch
and onLocalChange
.
Readonly
onEmitted when the model changes. Same as .onChange
, but this event is emitted once per microtask.
Readonly
onEmitted when the model.api
builder change buffer is flushed.
Readonly
onEmitted after local changes through model.api
are applied.
Readonly
onEmitted after local changes through model.api
are applied. Same as
.onLocalChange
, but this event buffered withing a microtask.
Readonly
onEmitted after a patch is applied using model.applyPatch()
.
Readonly
onEmitted after the model is reset, using the .reset()
method.
Readonly
onEmitted after transaction completes.
Optional
stopEvent target for listening to node changes. You can subscribe to "view"
events, which are triggered every time the node's view changes.
node.events.on('view', () => {
// do something...
});
Returns a proxy object for this node. Allows to access the value of the
node by accessing the .val
property.
Apply locally any operations from the .builder
, which haven't been
applied yet.
Optional
path: ApiPathReturns the API object of the extension if the node is an extension node.
When the ext
parameter is provided, it checks if the node is an instance
of the given extension and returns the object's TypeScript type. Otherwise,
it returns the API object of the extension, but without any type checking.
API of the extension
Returns the API object of the extension if the node is an extension node.
When the ext
parameter is provided, it checks if the node is an instance
of the given extension and returns the object's TypeScript type. Otherwise,
it returns the API object of the extension, but without any type checking.
API of the extension
Begins to automatically flush buffered operations into patches, grouping
operations by microtasks or by transactions. To capture the patch, listen
to the .onFlush
event.
Callback to stop auto flushing.
Optional
path: ApiPathOptional
path: ApiPathFind a child node at the given path starting from this node.
Optional
path: ApiPathPath to the child node to find.
JSON CRDT node at the given path.
Readonly
getOptional
path: ApiPathOptional
path: ApiPathSets the value of the node.
JSON/CBOR value or ID (logical timestamp) of the value to set.
Reference to itself.
Optional
path: ApiPathReadonly
subscribeOptional
path: ApiPathOptional
path: ApiPathReturns a local change API for the given node. If an instance already exists, returns the existing instance.
Local changes API for a JSON CRDT model. This class is the main entry point for executing local user actions on a JSON CRDT document.