Slide 6
Slide 6 text
BACKBONE.JS EVENT HANDLING
Models/Collections trigger events which Views can bind to.
Collection
reset(collection) - when the entire contents have been replaced
triggered by: fetch, reset, etc.
add(model, collection) - when a model is added to a collection
remove(model, collection) - when a model is removed from a collection
Model
change(model, options) – when a model’s attributes have changed
change:[attribute](model, value, options) – when a specific attribute has been updated
Some notes:
{silent: true}
.trigger(“[event]”)
documentcloud.github.com/backbone
• Syncs your views consistently with the data that drives it using rich event handling