diff --git a/index.html b/index.html index 0a4cdd1ee..17a6f484a 100644 --- a/index.html +++ b/index.html @@ -419,6 +419,7 @@
  • clone
  • fetch
  • create
  • +
  • mixin
  • @@ -2405,6 +2406,32 @@

    Backbone.Collection

    title: "Othello", author: "William Shakespeare" }); + + +

    + mixinBackbone.Collection.mixin(properties) +
    + mixin provides a way to enhance the base Backbone.Collection + and any collections which extend it. This can be used to add generic methods + (e.g. additional Underscore Methods). +

    + +
    +Backbone.Collection.mixin({
    +  sum: function(models, iteratee) {
    +    return _.reduce(models, function(s, m) {
    +      return s + iteratee(m);
    +    }, 0);
    +  }
    +});
    +
    +var cart = new Backbone.Collection([
    +  {price: 16, name: 'monopoly'},
    +  {price: 5, name: 'deck of cards'},
    +  {price: 20, name: 'chess'}
    +]);
    +
    +var cost = cart.sum('price');
     

    Backbone.Router

    @@ -4418,19 +4445,19 @@

    Change Log

    Added support for setting instance properties before the constructor in ES2015 classes with a preinitialize method.
  • - Added iterator support implementing JS Iterable protocol. + Collections now support the [Javascript Iterator Protocol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Iteration_protocols)
  • - Fixed a bug with the Router's hash generator. + `#listenTo` uses the listened object's public `#on` method. This keeps interop between Backbone and other event libraries (including Node.js).
  • - `#listenTo` uses the listened object's public `#on` method. This keeps interop between Backbone and any other event library (including Node.js). + Collection.get now checks if obj is a Model to allow retrieving models with an `attributes` key.
  • - Collection.get now checks if obj is a Model to allow retrieving models with an `attributes` key. + Fixed several issues with Router's URL hashing and parsing.
  • - We no longer test against IE8. Now we are not testing for <= IE8, with the goal of eventually refactoring some of the older hacks out. + We are no longer testing for <= IE8, with the goal of eventually refactoring some of the older hacks out.
  • @@ -4447,6 +4474,9 @@

    Change Log

    Added options.changes to Collection "update" event which includes added, merged, and removed models. +
  • + Added support for Collection#mixin and Model#mixin. +
  • Ensured Collection#reduce and Collection#reduceRight work without an initial accumulator value.