2.0.5 • Published 2 months ago

@ak-ch/state-machine v2.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

State Machine

A lightweight and easy to use and seamless state management library for web frameworks.

Prerequisites

This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
6.4.1
v8.16.0

Getting Started

Installation

BEFORE YOU INSTALL: please read the prerequisites

Start with installing this package into your package:

$ npm install -S @ak-ch/state-machine

Or if you prefer using Yarn:

$ yarn add --dev @ak-ch/state-machine

Usage

Import the utility directly into any component and use it right away. No need to configure it into root of your application. All complex logic to reflect your state changes across your application is taken care by us. You just chill and enjoy us working for you under the hood

watch for state changes anywhere in your application

import {stateMachine} from '@ak-ch/state-machine'

stateMachine.watchState(res=>{
    // start watching 
})

Broadcast your state update across application

stateMachine.updateState(state)

Reset your application state with new data

stateMachine.setState(newData)

Read current state at the moment

const snapshot = await stateMachine.readState()
console.log(snapshot)

Persist application state in local storage with minimal configuration

const configOtions = {
    persistible:true
}
stateMachine.config(configOptions)

Developer contact

For any queries, feedback or suggestioons please reach ot to me at akshayc409@gmail.com