3.0.0 • Published 6 years ago

@sunwukung/fsm v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

FSM

constructor(stateGraph, initialState)

action(id, ctx)

perform a predefined transition sequence using a named alias

getState()

return the current state of the machine

onChange(handler)

attach a handler that listens to changes in state change handlers receive an object thus:

{
    previous: previousState,
    current: currentState
}

onError(handler)

attach a handler that listens to machine errors error handlers receive an object thus:

{
    target: previousState,
    current: currentState
}

removeChangeSubscription(subscription)

remove the change handler by reference

removeErrorSubscription(subscription)

remove the error handler by reference

transition(targetState)

transition the machine state to the target state

factory

wrapper to guarantee new keyword

3.0.0

6 years ago

2.0.0

6 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.0

8 years ago