praekelt/vumi-jssandbox-toolkit — pull request #76 by hodgestar (2014-02-20 09:29:50+00:00)
Title: Add MenuState.

Menus for selecting one of a set of following states are pretty common:

```javascript
self.states.add('states:main_menu', function(name) {
return new ChoiceState(name, {
question: "Ureport (Speak out for your community)",
choices: [
new Choice('poll', "This week's question"),
new Choice('results', 'Poll results'),
new Choice('reports', 'Send report')
],
next: function(choice) {
return {
poll: 'states:poll:question',
results: 'states:results:choose',
reports: 'states:reports:submit'
}[choice.value];
}
});
});
```

Would be nice to be able to write these as:

```javascript
self.states.add('states:main_menu', function(name) {
return new MenuState(name, {
question: "Ureport (Speak out for your community)",
choices: [
new Choice('states:poll:question', "This week's question"),
new Choice('states:results:choose', 'Poll results'),
new Choice('states:reports:submit', 'Send report')
]
});
});
```