documentcloud/backbone — pull request #1458 by ianstormtaylor (2012-06-26 21:18:08+00:00)
Title: added lifetime events to model, collection, router, view

sorry for the confusion with the other lifetime events pull request. here's how i think they should be done. this would eliminate the need for the `_configure` method in Model, Collection and Router, and the one in View could even be inlined.

the `configure` event would be extremely useful as a standard way to add things pre-initialize.

i think `initialize` should be for view-specific configuration, not View configuration. if i know i want Views or Models as a whole to behave differently, that is not something i want to have to maintain in `initialize` all the time.

View just so happens to have the `_configure` method, which can act as a hook for this View-wide configuration logic. but Model, Collection and Router don't. so what i'm actually asking for is a dependable hook into configuration logic for the "class" itself, instead of on a per-subClass basis. if that makes sense.

right now, if i want to alter how models dealt with attributes coming in, i'd have to copy/paste the `constructor` and edit it. but with the `configure` event, i could just hook in.

either way (the `_configure` method or triggering `configure` events) would solve the problem that the core configuration logic isn't pluggable enough.

could be convinced against `change:element`. `render` is simply a demonstration of what their overwritten render could look like. and then if `render` and `initialize` it seems like it makes sense to have `remove` as well.