Skip to content

Instantly share code, notes, and snippets.

@carlwoodward
Created May 5, 2011 02:25
Show Gist options
  • Select an option

  • Save carlwoodward/956421 to your computer and use it in GitHub Desktop.

Select an option

Save carlwoodward/956421 to your computer and use it in GitHub Desktop.
States as first class objects, with transitions
class IndexState extends State
constructor: ->
super()
@route = '/'
@mappings =
null: =>
@render()
FinishedEditingState: =>
@doSomethingElseFirst()
@render()
render: ->
$.get '/templates/forms/forms.jade', (response) =>
$('#app').html jade.render(response)
States.register IndexState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment