1.0.12 • Published 5 years ago
the-state v1.0.12
the-state
State holder for the-components
Installation
$ npm install the-state --save
Usage
'use strict'
const { TheState } = require('the-state')
async function tryExample () {
const state = new TheState()
const account = state.scope('account')
state.subscribe(({ account }) => {
// Handle change
/* ... */
})
account.set({ name: 'John', password: 'xxxxx' })
console.log(account.get('name')) // John
}
tryExample().catch((err) => console.error(err))
API Guide
License
This software is released under the MIT License.