Javascript state machine for Meteor