Skip to content

Instantly share code, notes, and snippets.

@nottombrown
Created February 8, 2012 19:50
Show Gist options
  • Save nottombrown/1772806 to your computer and use it in GitHub Desktop.
Save nottombrown/1772806 to your computer and use it in GitHub Desktop.
myState = "external state"
class TestModel extends Backbone.Model
initialize: (options) ->
@myState = "internal state"
printState: =>
console.log @myState
$ ->
model = new TestModel()
# If we had not used a fat arrow, 'this' would reference the el that received
# the click event.
$("#print").click(model.printState) # --> internal state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment