Created
August 30, 2012 14:27
-
-
Save jslatts/3529602 to your computer and use it in GitHub Desktop.
Underscore/backbone this binding question
This file contains hidden or 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
<snip> | |
initialize: function() { | |
_.bindAll(this, 'addEvent', 'render'); | |
this.eventFeed = this.options.eventFeed; | |
this.eventFeed.on('add', this.addEvent); | |
}, | |
render: function() { | |
$.get('/views/jsondata', function(data) { | |
var newModel = new models.SomeModel(data); | |
this.eventFeed.add(newModel); | |
}); | |
}, | |
addEvent: function(e) { | |
//Stuff | |
} | |
</snip> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment