Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for sharing of Transition functions #21

Open
eonarheim opened this issue Oct 19, 2017 · 0 comments
Open

Allow for sharing of Transition functions #21

eonarheim opened this issue Oct 19, 2017 · 0 comments

Comments

@eonarheim
Copy link
Owner

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];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant