Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Backbone.EventBinder

View 1.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
doStuff = {
 
start: function(a, b, c){
this.events = new Backbone.EventBinder();
 
this.events.bindTo(a, "foo", this.doSomething, this);
this.events.bindTo(b, "bar", this.anotherThing, this);
this.events.bindTo(c, "baz", this.whatever, this);
},
 
doSomething: function(){ /* ... */ },
anotherThing: function(){ /* ... */ },
whatever: function(){ /* ... */ },
 
stop: function(){
this.events.unbindAll();
}
 
}
 
doStuff.start(ObjA, ObjB, ObjC);
 
// ... some time later in the code, stop it
 
doStuff.stop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.