TinyBase logoTinyBase β

getMergeableTableHashes

The getMergeableTableHashes method returns hashes for the Table objects in a MergeableStore.

getMergeableTableHashes(): TableHashes
returnsTableHashes

A TableHashes object with the hashes of each Table in the MergeableStore.

If two Table 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 Table hashes.

import {createMergeableStore} from 'tinybase';

const store = createMergeableStore('store1');

store.setCell('pets', 'fido', 'color', 'brown');
console.log(store.getMergeableTableHashes());
// -> {pets: 518810247}

store.setCell('species', 'dog', 'price', 5);
console.log(store.getMergeableTableHashes());
// -> {pets: 518810247, species: 2324343240}

Since

v5.0.0