# @mixery/state-machine

> Yet another state-related package

Latest version **1.0.0** (published 2022-12-03) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @mixery/state-machine
pnpm add @mixery/state-machine
yarn add @mixery/state-machine
bun add @mixery/state-machine
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-12-03 |
| First published | 2022-12-03 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 38.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | nahkd123 |
| Maintainers | nahkd123 |
| Keywords | state, mixery |

## Links

- npm: https://www.npmjs.com/package/@mixery/state-machine
- Repository: https://github.com/MixeryOSS/state-machine
- Homepage: https://github.com/MixeryOSS/state-machine#readme
- Issues: https://github.com/MixeryOSS/state-machine/issues
- npm.io page: https://npm.io/package/@mixery/state-machine

## Alternatives

- [@reckona/mreact-store](https://npm.io/package/@reckona/mreact-store.md) — 976 weekly downloads
- [regular-state](https://npm.io/package/regular-state.md) — 410 weekly downloads
- [@pacote/flux-actions](https://npm.io/package/@pacote/flux-actions.md) — 65 weekly downloads
- [@pilotlab/lux-debug](https://npm.io/package/@pilotlab/lux-debug.md) — 39 weekly downloads
- [vue-persist-state](https://npm.io/package/vue-persist-state.md) — 19 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-12-03

## README

# State Machine
_Yet another state-related package_

State machine allows you to share value across all components through the usage of ``Slot``. Each ``Slot`` can watch for any changes in value (either by changing its internal value or from binded slot).

## Example
```ts
import * as sm from "@mixery/state-machine";

let mySlot = new sm.Slot<string>("default value (optional)");
mySlot.onChange.add((newValue, oldValue) => {
    console.log(newValue, oldValue);
});
mySlot.value = "new value";

let anotherSlot = new sm.Slot<string>();
mySlot.bindTo(anotherSlot);
anotherSlot.value; // "new value"
```

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