# andshil-ts-statemachine

> Typescript realization of state machine

Latest version **0.1.1** (published 2020-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install andshil-ts-statemachine
pnpm add andshil-ts-statemachine
yarn add andshil-ts-statemachine
bun add andshil-ts-statemachine
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2020-08-14 |
| First published | 2020-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Shilkin |
| Maintainers | andrewshilkin |
| Keywords | typescript, statemachine |

## Links

- npm: https://www.npmjs.com/package/andshil-ts-statemachine
- Repository: https://github.com/andrewshilkin/ts-statemachine
- Homepage: https://github.com/andrewshilkin/ts-statemachine#readme
- Issues: https://github.com/andrewshilkin/ts-statemachine/issues
- npm.io page: https://npm.io/package/andshil-ts-statemachine

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2020-08-14
- 0.1.0 — 2020-08-14

## README

# andshil-ts-statemachine
Typescript realization of state machine

sample: 
```typescript
// create need states
class IdleState extends StateMachineClasses.BaseState {
    public execute(): void {
        console.log("Idle State");
    }
    public cleanUp(): void {
    }
}
class WinState extends StateMachineClasses.BaseState {
    public execute(): void {
        console.log("WinState State");
    }
    public cleanUp(): void {
    }
}
// create concrete state machine class 
class StateMachine extends StateMachineClasses.StateMachine {
    public get states(): (typeof StateMachineClasses.BaseState)[] {
        return [
            IdleState,
            WinState
        ]
    }
}

// create instance, and change states
let stateMachine: StateMachine = new StateMachine();
stateMachine.setState(0);
stateMachine.setState(1);
```

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