TinyBase logoTinyBase

setMergeableContent

The setMergeableContent method sets the full content of a MergeableStore, together with the metadata required to make it mergeable with another.

setMergeableContent(mergeableContent: MergeableContent): MergeableStore
TypeDescription
mergeableContentMergeableContent

The full content and metadata of a MergeableStore.

returnsMergeableStore

A reference to the MergeableStore.

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 new MergeableStore and initializes it with the content and metadata from another.

import {createMergeableStore} from 'tinybase';

const store1 = createMergeableStore('store1');
store1.setValues({employees: 3});
console.log(store1.getMergeableContent());
// ->
[
  [{}, '', 0],
  [{employees: [3, 'Nn1JUF-----FnHIC', 1940815977]}, '', 1260895905],
];

const store2 = createMergeableStore('store2');
store2.setMergeableContent(store1.getMergeableContent());
console.log(store2.getMergeableContent());
// ->
[
  [{}, '', 0],
  [{employees: [3, 'Nn1JUF-----FnHIC', 1940815977]}, '', 1260895905],
];

Since

v5.0.0