README
ts-state
ts-state is a simple State Management System written in TypeScript. It is intended to be used in places where there is a need for state management at a small level. For example, if there is a Node.JS project, if multiple modules share the same variable, instead of using the global, one might feel the need to use this library.
Installation
npm i --save ts-state
How to use?
import { setState, getState } from 'ts-state'
console.log(getState()) // Outputs -> {}
setState()
console.log(getState()) // Outputs -> {}
setState({a: 10, b: 'bbb'})
console.log(getState()) // Outputs -> { a: 10, b: 'bbb' }
setState({a: 101, c: function() { console.log('ccc') }})
console.log(getState()) // Outputs -> { a: 101, b: 'bbb', c: [Function: c] }
getState()['c']() // Outputs -> ccc