# jetstate

> state managment

Latest version **1.3.1** (published 2021-02-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install jetstate
pnpm add jetstate
yarn add jetstate
bun add jetstate
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2021-02-22 |
| First published | 2018-12-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | itten |

## Links

- npm: https://www.npmjs.com/package/jetstate
- Repository: https://github.com/behnammodi/jetstate
- Homepage: https://github.com/behnammodi/jetstate#readme
- Issues: https://github.com/behnammodi/jetstate/issues
- npm.io page: https://npm.io/package/jetstate

## Recent versions

- 1.3.1 (latest) — 2021-02-22
- 1.3.0 — 2019-02-19
- 1.2.2 — 2019-01-23
- 1.2.1 — 2019-01-09
- 1.2.0 — 2019-01-09
- 1.1.1 — 2018-12-14
- 1.1.0 — 2018-12-14
- 1.0.0 — 2018-12-14

## README

# jetstate

[![NPM](https://nodei.co/npm/jetstate.png)](https://nodei.co/npm/jetstate/)

[![install size](https://packagephobia.now.sh/badge?p=jetstate)](https://packagephobia.now.sh/result?p=jetstate) [![dependencies](https://david-dm.org/uxitten/jetstate.svg)](https://david-dm.org/uxitten/jetstate.svg)


<a href="https://www.npmjs.com/package/jetstate">
  <img src="https://img.shields.io/npm/v/jetstate.svg" alt="Version">
</a>

<a href="https://www.npmjs.com/package/jetstate">
  <img src="https://img.shields.io/npm/l/jetstate.svg" alt="License">
</a>

<a href="https://www.npmjs.com/package/jetstate">
  <img src="https://img.shields.io/npm/dm/jetstate.svg" alt="Downloads">
</a>

state managment

## install
```npm
npm i jetstate --save
```

## use
```javascript
import { init, state } from 'jetstate';

/**
 * initial new state
 */
init({
  name: 'time',
  defaultValue: new Date().getTime(), 
  willUpdate: (previousValue, nextValue) => {
    console.log('willUpdate', previousValue, nextValue);
  },
  shouldUpdate: (previousValue, nextValue) => {
    if (typeof nextValue 'number') return true;
    else return false        
  },
  didUpdate: value => {
    console.log('didUpdate', value);
  }
});

var time = state.time;

//with this code, willUpdate is run and then didUpdate is run
state.time = new Date().getTime();
```

---
_Source: https://npm.io/package/jetstate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
