Skip to main content

Access the Store

All values are available through the store except in-store-mutators. Use the get method for easy or programmatic access to paths, or access the values directly through the store. Later we will react to changes with events.

myStore.js
import nst from './myStore.js'

let loggedIn = nst.get('logged_in')
let captain = nst.store.captains_name

// look at me
captain = 'I am the captain now'

// I am the captain now
console.log(nst.store.captains_name)
note

The store is a mutable object with persistent references. Any direct access to nst.store.path or nst.store[path] will return that value with its current reference. Be cautious of unintended updates to store values by reference.

Access Mutator Functions

Nestore exposes the stores top level functions as mutators.

import nst from  './myStore.js'

const user = await nst.login('AliceAware11', 'password1234')