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(): Content
returnsContent

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.

import {createStore} from 'tinybase';

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.

import {createStore} from 'tinybase';

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

Since

v4.0.0