Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Backbone apps - simplify `clearCompleted` logic

  • Loading branch information...
commit 7f17ef8f455043869c7e1a3d5a85b2bd3b57a70d 1 parent 8e20c96
@sindresorhus sindresorhus authored
View
5 architecture-examples/backbone/js/views/app.js
@@ -111,10 +111,7 @@ $(function( $ ) {
// Clear all completed todo items, destroying their models.
clearCompleted: function() {
- _.each( app.Todos.completed(), function( todo ) {
- todo.destroy();
- });
-
+ _.invoke(app.Todos.completed(), 'destroy');
return false;
},
View
5 dependency-examples/backbone_require/js/views/app.js
@@ -112,10 +112,7 @@ define([
// Clear all completed todo items, destroying their models.
clearCompleted: function() {
- _.each( Todos.completed(), function( todo ) {
- todo.destroy();
- });
-
+ _.invoke(Todos.completed(), 'destroy');
return false;
},
Please sign in to comment.
Something went wrong with that request. Please try again.