-
Notifications
You must be signed in to change notification settings - Fork 966
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
Statedefs #145
base: master
Are you sure you want to change the base?
Statedefs #145
Conversation
Hmm - trying this in a real world app and seeing a bug in the visualization generation. Hold off until I figure it out. -- Ah - never mind. I had added states with the same name as the transition name. I suppose in principle, that's ok. I wonder if it would be worth enforcing not allowing that? It's something I would like to detect in my own usage... At any rate, I caught it in the visualization (another reason I think the visualization capability is a killer feature.) Followup: |
Added tests.
@rickbsgu contribution welcomed. https://github.com/taoqf/javascript-state-machine |
Changes add the option to define states prior to transitions.
Allows:
Also adds a dot prefix definition to set attributes for the entire graph (the default is pretty ugly.) A default set is specified, but can be overridden.
Statedefs are implemented in parallel with the current state mechanism to insure that the package still works as before. The statedefs mechanism only kicks in if statedefs are defined in the fsm definition.
All of the regression tests pass (had to modify the plugin/visualize test somewhat extensively to accommodate the dot prefix mechanism.) I also have added a test file with some tests (statedefs.js). Thinking of more.
Finally, some small changes to the 'examples' executable to allow a single example to be run. Added an example 'traffic_light_statedefs' that demonstrates the dot attributes for states.
I haven't touched the documentation - want to field thoughts from you on where would be the appropriate place to document this.
Let me know what your thoughts are.
Thanks,
rickb