Last active
May 2, 2017 01:32
-
-
Save brettjonesdev/812fe02a455d08e9e4a4c62821cccabc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = new Application(); | |
App.selectedTodos = new Backbone.Collection(); | |
// List Route | |
const collection = new TodoCollection(); | |
collection.fetch().then(() => { | |
const listView = new ListView({ | |
collection, | |
selectedTodos: App.selectedTodos | |
}).render(); | |
}); | |
// ListView | |
const ListView = Backbone.View.extend({ | |
initialize(options) { | |
this.selectedTodos = options.selectedTodos | |
}, | |
select(model) { | |
this.selectedTodos.add(model); | |
}, | |
unselect(model) { | |
this.selectedTodos.remove(model); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment