TinyBase logoTinyBase β

getMergeableValueHashes

The getMergeableValueHashes method returns hashes for the Value objects in a MergeableStore.

getMergeableValueHashes(): ValueHashes
returnsValueHashes

A ValueHashes object with the hashes of each Value in the MergeableStore.

If two Value Ids have different hashes, that indicates that the content within them is 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 Value hashes.

import {createMergeableStore} from 'tinybase';

const store = createMergeableStore('store1');

store.setValue('employees', 3);
console.log(store.getMergeableValueHashes());
// -> {employees: 1940815977}

store.setValue('open', true);
console.log(store.getMergeableValueHashes());
// -> {employees: 1940815977, open: 3860530645}

Since

v5.0.0