TinyBase logoTinyBase β

getStoreIds

The getStoreIds function returns a reactive object with the Ids of all Stores registered in the current Provider context.

getStoreIds(): {current: Ids}
returns{current: Ids}

A reactive object with a current Ids property.

Example

This example reads a TinyBase object from Svelte context inside a child component.

Child.svelte
<svelte:options runes={true} />

<script>
  import {getStoreIds} from 'tinybase/ui-svelte';
</script>

{JSON.stringify(getStoreIds().current)}
App.svelte
<svelte:options runes={true} />

<script>
  import {Provider} from 'tinybase/ui-svelte';
  import Child from './Child.svelte';

  let {store} = $props();
</script>

<Provider storesById={{petStore: store}}>
  <Child />
</Provider>
import {flushSync, mount} from 'svelte';
import {createStore} from 'tinybase';
import App from './App.svelte';

const store = createStore().setCell('pets', 'fido', 'species', 'dog');
const app = document.body.appendChild(document.createElement('div'));
flushSync(() => mount(App, {target: app, props: {store}}));
console.log(app.textContent);
// -> '["petStore"]'

Since

v8.1.0