TinyBase logoTinyBase

getContent

The getContent method returns a Tables object and a Values object in an array, representing the entire content of the Store.

getContent(): [Tables, Values]
returns[Tables, Values]

An array of a Tables object and a Values object.

Note that this returns a copy of, rather than a reference to the underlying data, so changes made to the returned objects are not made to the Store itself.

Examples

This example retrieves the content of a Store.

const store = createStore()
  .setTables({pets: {fido: {species: 'dog'}}})
  .setValues({open: true, employees: 3});
console.log(store.getContent());
// -> [{pets: {fido: {species: 'dog'}}}, {open: true, employees: 3}]

This example retrieves the Tables and Values of an empty Store, returning empty objects.

const store = createStore();
console.log(store.getContent());
// -> [{}, {}]

Since

v4.0.0