/labs/architecture-examples/backbone_marionette/js/collections/TodoList.js
JavaScript | 19 lines | 16 code | 3 blank | 0 comment | 0 complexity | b38efdb02ea8524f2b8cc0ad3dbe0034 MD5 | raw file
- var TodoList = (function(){
- function isCompleted(todo) { return todo.get('completed'); }
- return Backbone.Collection.extend({
- model: Todo,
- localStorage: new Backbone.LocalStorage('todos-backbone'),
- getCompleted: function() {
- return this.filter(isCompleted);
- },
- getActive: function() {
- return this.reject(isCompleted);
- },
- comparator: function( todo ) {
- return todo.get('created');
- }
- });
- }());