Anton Shestakov <engored@ya.ru>, Fri, 14 Dec 2012 23:54:33 +0900
Changes for Backbone 0.9.9: Shards now also proxy Underscore method name aliases.
Backbone.Shard is a variation on a Subset taken from different perspective.
Shard was built as a simple "persistent filter" for collections; it can
help grouping and displaying items of certain kind based on your filter
function. I know it works for me, but your mileage may vary.
It's easy if you're familiar with Backbone.Collection since Shard shares
with it most of the methods marked
**Underscore methods** in the
`documentation <http://backbonejs.org/#Collection-Underscore-Methods>`_:: var shelf = Backbone.Shard({ filter: function(book) { return book.get('read'); } You can add/remove models or reset
*the original collection* and Shard will
honestly try to keep up with it, but currently Shard itself has no methods
such as add/remove/reset.
Events work and respect your filter function
:: shelf.on('add', doSomething); collection.add({read true}); // this will call doSomething collection.add({read: false}); // this won't <https://bitbucket.org/engored/backbone-shard/get/tip.tar.bz2>`_ and open
test/index.html in your browser.