Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#trigger {margin: 5em;}
<!DOCTYPE html>
<script src="//"></script>
<script src="//"></script>
<script src="//"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<div id="app"></div>
var myModel = Backbone.Model.extend({});
var myCollection = Backbone.Collection.extend({
doStuff: function(){ alert("doing Stuff"); },
doOtherStuff: function(){ alert("doing other stuff"); }
var myCollectionView = Backbone.View.extend({
template: "<button id='trigger'>Trigger</button>",
initialize: function(){
this.listenTo(this.collection, 'sync', this.collection.doStuff);
this.listenTo(this.collection, 'sync', this.collection.doOtherStuff);
events: {
"click #trigger": "trigger"
render: function(){
trigger: function(){
var mymodel = new myModel({}),
mycollection = new myCollection({
model: mymodel
mycollectionview = new myCollectionView({
collection: mycollection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment