Created
February 8, 2012 19:50
-
-
Save nottombrown/1772806 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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