TinyBase logoTinyBase

getYDoc

The getYDoc method returns the Yjs document the Store is being persisted to.

getYDoc(): Doc
returnsDoc

The Yjs document.

Example

This example creates a Persister object against a newly-created Store and then gets the Yjs document back out again.

const doc = new Y.Doc();
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
const persister = createYjsPersister(store, doc);

console.log(persister.getYDoc() == doc);
// -> true

persister.destroy();

Since

v4.3.14