Skip to content

Commit

Permalink
use Marionette's event hashes for Model and Collection events
Browse files Browse the repository at this point in the history
  • Loading branch information
callmephilip committed May 1, 2013
1 parent 8ea9aef commit dccfdac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ TodoMVC.module('Layout', function (Layout, App, Backbone) {
'click #clear-completed': 'onClearClick'
},

collectionEvents: {
'all': 'updateCount'
},

initialize: function () {
this.listenTo(App.vent, 'todoList:filter', this.updateFilterSelection, this);
this.listenTo(this.collection, 'all', this.updateCount, this);
},

onRender: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ TodoMVC.module('TodoList.Views', function (Views, App, Backbone, Marionette, $)
'click .toggle': 'toggle'
},

initialize: function () {
this.listenTo(this.model, 'change', this.render, this);
modelEvents: {
'change': 'render'
},

onRender: function () {
Expand Down Expand Up @@ -93,8 +93,8 @@ TodoMVC.module('TodoList.Views', function (Views, App, Backbone, Marionette, $)
'click #toggle-all': 'onToggleAllClick'
},

initialize: function () {
this.listenTo(this.collection, 'all', this.update, this);
collectionEvents: {
'all' : 'update'
},

onRender: function () {
Expand Down

0 comments on commit dccfdac

Please sign in to comment.