@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(() => {
// Handle change
/* ... */
})
account.set({ name: 'John', password: 'xxxxx' })
console.log(account.get('name')) // John
}
tryExample().catch((err) => console.error(err))
API Guide
- module:@the-/state
- module:@the-/state.constants
- module:@the-/state.state
- ScopedState
- State
See API Guide for more detail
License
This software is released under the MIT License.