documentcloud/backbone — pull request #2560 by pheuter (2013-05-25 16:14:54+00:00)
Title: Added 'remove' event when view is removed()

When it comes to integrating with third-party libraries and, in general, code that retains a connection with the view and communicates via events, knowing when the view is removed is an important piece of information.

Consider a library that takes a Backbone.View and sends it events whenever something happens, be it DOM mutations or server communications. It would be really great if the library could listen for when the view gets removed and stop processing for that view.

With the minimal addition of the view `remove` event, any code that interacts and depends on the view would be able to free resources appropriately at the opportune moment, that is for the duration of the view's existence. This can be thought of the view's equivalent of a model 'destroy'.