TinyBase logoTinyBase β

getDbName

The getDbName method returns the unique key of the IndexedDB the Store is being persisted to.

getDbName(): string
returnsstring

The unique key of the IndexedDB.

Example

This example creates a Persister object against a newly-created Store and then gets the unique key of the IndexedDB back out again.

import {createIndexedDbPersister} from 'tinybase/persisters/persister-indexed-db';
import {createStore} from 'tinybase';

const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
const persister = createIndexedDbPersister(store, 'petStore');

console.log(persister.getDbName());
// -> 'petStore'

persister.destroy();

Since

v4.3.14