What's a good syntax for representing a state-machine in JSON, for easy
consumption by e.g.: an AngularJS Service?
Specifically I have one starting (initial) state and multiple end-states.
State transition occurs based on user-choice.
Here's one way I can think of:
[
{'state': 'begin', 'vars': [],
'input': {'{"foo":"bar"}': 'add_foo', '{"haz":"can"}': 'add_haz'},
{'state': 'add_foo', 'vars': [{'foo': 'bar'}],
'input': {'end': 'end_st0', 'start': 'begin'}},
{'state': 'add_haz', 'vars': [{'haz': 'can'}],
'input': {'end': 'end_st1', 'start': 'begin'}},},
{'state': 'end_st0', 'vars': [{'foo': 'bar'}]},
{'state': 'end_st1', 'vars': []}]
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.