backbone.listenablemodel

Composite model for Backbone.js

Backbone.ListenableModel

Nested listenable model for Backbone with proper event bubbling.

Listen to models the normal way

  var model = new Backbone.ListenableModel({
    value : true
  });
  
  model.on('change:value', function(){console.log('value changed!');});

Listen to submodel events

  var model = new Backbone.ListenableModel({
    value    : true,
    submodel : new Backbone.ListenableModel({
      subvalue : true
    });
  });
  
  model.on('change:value', function(){console.log('value changed!');});
  model.on('submodel.change:subvalue', function(){console.log('subvalue changed!');});

Also works with Backbone.Collection events!