Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "fetch" event on Models and Collections to be able to observe it.…
… I found this pretty useful to add "generic" loader views on any collections/models. Simple example, a generic loader that can be quickly binded to any collection, and will do the job. var Loader = Backbone.View.extend({ tagName:'img', attributes:{ src:'loader.gif' }, initialize:function() { _.bindAll(this,'hide','show') this.collection.on('reset',this.hide); this.collection.on('fetch',this.show); }, hide:function() { $(this.el).hide(); }, show:function() { $(this.el).show(); } })
- Loading branch information