TinyBase logoTinyBase β

getDocHandle

The getDocHandle method returns the Automerge document handler the Store is being persisted to.

getDocHandle(): DocHandle<any>
returnsDocHandle<any>

The Automerge document handler.

Example

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

import {Repo} from '@automerge/automerge-repo';
import {createAutomergePersister} from 'tinybase/persisters/persister-automerge';
import {createStore} from 'tinybase';

const docHandler = new Repo({network: []}).create();
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
const persister = createAutomergePersister(store, docHandler);

console.log(persister.getDocHandle() == docHandler);
// -> true

persister.destroy();

Since

v4.3.14