Home > yorkie-js-sdk > Document

Document class

Document is a CRDT-based data type. We can representing the model of the application. And we can edit it even while offline.


declare class Document<T> implements Observable<DocEvent> 

Implements: Observable<DocEvent>


Constructor Modifiers Description
(constructor)(key)   Constructs a new instance of the Document class


Method Modifiers Description
applyChanges(changes)   applyChanges applies the given changes into this document.
applySnapshot(serverSeq, snapshot)   applySnapshot applies the given snapshot into this document.
create(key) static create creates a new instance of Document.
getRoot()   getRoot returns a new proxy of cloned root.
subscribe(nextOrObserver, error, complete)   subscribe adds the given observer to the fan-out list.
toJSON()   toJSON returns the JSON encoding of this array.
toSortedJSON()   toJSON returns the sorted JSON encoding of this array.
update(updater, message)   update executes the given updater to update this document.