TinyBase logoTinyBase

getStorageName

The getStorageName method returns the unique key of the storage location the Store is being persisted to.

getStorageName(): string
returnsstring

The unique key of the storage location.

Example

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

import {createSessionPersister} from 'tinybase/persisters/persister-browser';
import {createStore} from 'tinybase';

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

console.log(persister.getStorageName());
// -> 'pets'

persister.destroy();

Since

v4.3.14