getMergeableCellHashes
The getMergeableCellHashes
method returns hashes for Cell
objects in a MergeableStore
.
getMergeableCellHashes(otherTableRowHashes: RowHashes): CellHashes
Type | Description | |
---|---|---|
otherTableRowHashes | RowHashes | The |
returns | CellHashes | A |
If two Cell
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 Cell
hashes for the differing Table
Ids
.
import {createMergeableStore} from 'tinybase';
const store1 = createMergeableStore('store1');
store1.setTables({pets: {fido: {color: 'brown', species: 'dog'}}});
const store2 = createMergeableStore('store2');
store2.setTables({pets: {fido: {color: 'black', species: 'dog'}}});
console.log(
store1.getMergeableCellHashes(
store2.getMergeableRowDiff(
store1.getMergeableRowHashes(
store2.getMergeableTableDiff(store1.getMergeableTableHashes())[1],
),
)[1],
),
);
// -> {pets: {fido: {color: 923684530, species: 227729753}}}
Since
v5.0.0