ifandelse/machina.js — pull request #16 by mtrimpe (2013-02-28 18:01:06+00:00)
Title: Added the ability for handlers to transition by returning a string value.

I've been using machina.js to build an (Ember-like) state machine based Router for Backbone.

It is working quite well, but one thing that got visually ugly was when I was switching to different states based on application state.

That's why I added the ability to transition to a state based on the handler's return value, turning this:
```javascript
"complex": function() {
if ( specialCase ) {
this.transition("error");
} else {
this.transition(lastStep ? "finish" : "continue" ) ;
},
},
"simple": function() {
this.transition(answered ? "answer" : "record") ;
},
```
into
```javascript
"complex": function() {
if (specialCase) return "error";
return lastStep ? "finish" : "continue" ;
},
"simple": function() { return answered ? "answer" : "record" },
```