TypeState icon indicating copy to clipboard operation
TypeState copied to clipboard

Allow for sharing of Transition functions

Open eonarheim opened this issue 8 years ago • 0 comments

Bug

As referenced in #20, transition functions can be shared across FSM to be more memory efficient since they don't need a reference to their parent FSM.

Proposed fix

Allow for transition functions to be set either in the constructor of the fsm or as a property.


var fsm = new typestate.FiniteStateMachine<States>(State.StartState, [...transistionFunctions]);

// or

var fsm = new typestate.FinitStateMachine<States>(State.StartState);
fsm.functions = [...transitionFunctions];

eonarheim avatar Oct 19 '17 00:10 eonarheim