Stores

Stores manages any Store instances used in the app.

Singleton, accessible using getStores() helper

import { getStores } from 'zuglet/utils';
let stores = getStores(this);

stats → Stats

Returns singleton Stats instance.

models → Models

Returns singleton Models instance.

createStore(identifier, factory) → Store

Creates a new store.

import BaseStore from 'zuglet/store';

class Store extends BaseStore {
}

let store = getStores(this).createStore('store', Store);

store(identifier, { optional })

Returns existing store.

  • optional → boolean, defaults to false
let missing = getStores(this).store('missing', { optional: true });
missing // → undefined

let existing = getStores(this).store('existing');
existing // → Store

async settle() → undefined

Alias for stores.stats.settle()