Created
December 6, 2011 10:29
-
-
Save yaotti/1437699 to your computer and use it in GitHub Desktop.
Backbone.jsでモデルとビューを分離しやすくするためにadd/resetイベントを活用 ref: http://qiita.com/items/1304
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
model.bind('hoge', function () { | |
alert('hogeされた'); | |
}); | |
model.trigger('hoge'); // => alert('hogeされた'); |
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
var items = new Backbone.Collection; | |
items.bind("add", function(item) { | |
alert("New item is added: " + item.title); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment