@nuware/store

State container

Usage no npm install needed!

<script type="module">
  import nuwareStore from 'https://cdn.skypack.dev/@nuware/store';
</script>

README

Store

Install

npm install @nuware/store --save

or

<script defer src="https://unpkg.com/@nuware/store@latest/dist/store.umd.js"></script>

or

<script defer src="https://unpkg.com/@nuware/store@latest/dist/store.min.js"></script>

Usage

Browser

const Store = window.nuware.Store

Node

const Store = require('@nuware/store')

or

import Store from '@nuware/store'

Initialize Store

const store = Store({
  any: {
    initial: {
      state: true
    }
  }
})

API

Store

Factory function return the Store instance. You can pass the initial state of this Store.

store

Store instance.

store.ref()

store.VALUE_EVENT

store.CHILD_ADDED_EVENT

store.CHILD_CHANGED_EVENT

store.CHILD_REMOVED_EVENT

ref

ref.child()

ref.parent()

ref.get()

ref.set()

ref.remove()

ref.on()

ref.off()

Authors

License