JS-based Finite State Machine for Backbone.js