TinyBase logoTinyBase β

getMergeableContentHashes

The getMergeableContentHashes method returns hashes for the full content of a MergeableStore.

getMergeableContentHashes(): ContentHashes
returnsContentHashes

A ContentHashes array for the hashes of the full content of the MergeableStore.

If two MergeableStore instances have different hashes, that indicates that the mergeable Tables or Values within them are different and should be synchronized.

The method is generally intended to be used internally within TinyBase itself and the return type is assumed to be opaque to applications that use it.

Example

This example creates a MergeableStore, sets some data, and then accesses the content hashes.

import {createMergeableStore} from 'tinybase';

const store = createMergeableStore('store1');

store.setCell('pets', 'fido', 'color', 'brown');
console.log(store.getMergeableContentHashes());
// -> [784336119, 0]

store.setValue('open', true);
console.log(store.getMergeableContentHashes());
// -> [784336119, 2829789038]

Since

v5.0.0