0.3.0 • Published 1 year ago

@bleckert/state v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Install

npm i @bleckert/state or yarn add @bleckert/state

Usage

import Machine from '@bleckert/state';

const machine = new Machine({
    IDLE: {
        on: {
            send: 'SENDING',
        },
    },
    SENDING: {
        on: {
            sent: 'SENT',
            failed: 'ERROR',
        },
    },
    SENT: {
        final: true,
    },
    FAILED: {
        on: {
            retry: 'SENDING',
        },
    },
});

machine.onState('SENDING', console.log);
machine.dispatch('send');
0.3.0

1 year ago

0.2.0

1 year ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago