Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    backbone.listenablemodelpublic

    Backbone.ListenableModel

    Build Status Dependency Status

    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!

    Keywords

    none

    install

    npm i backbone.listenablemodel

    Downloadslast 7 days

    5

    version

    0.0.4

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar