The short answer is yes, there is overlap.
A more complex answer is that the listenTo / stopListening methods introduced in Backbone 0.9.9 already use the on / off methods, but with some useful addition - they store the current event listeners in an internal object called _listeners.
The advantage of using this object is that you always know the complete list of all your listeners - you can iterate over it and remove certain elements from it (remember that the listener is just a function, and a function is just an object).
So you can call it this:
this.stopListening(emitting_object, ["reset", "add"]) // Removes listeners for "reset" and "add" on emitting_object this.stopListening(emitting_object) // Removes all listeners on emitting_object this.stopListening() // Iterates over _listeners object and removes all listeners (probably the most usable case)
So, using this method, you can convert your teardown method to the following:
this.teardown = function(){ this.stopListening(); ... }
source share