batmanjs/batman — pull request #912 by rmosolgo (2013-11-26 00:21:43+00:00)
Title: ActiveRecord-style model callbacks

We've been using [AR-style](http://edgeguides.rubyonrails.org/active_record_callbacks.html) `before`- and `after`-callbacks around here, and I thought I'd try to upstream it, if possible.

I've got a simple implementation of before/after Create, Update and Destroy. What do you think of the syntax? Am I on the right track for implementation?

__To Do:__

- test that before/after callbacks are in the right sequence with the operation, not just each other (like the lifecycle test)
- beforeSave/afterSave (runs on create or update)
- Other AR callbacks? before/afterValidation, before/afterInitialize, before/afterFind
- accept anonymous functions, named functions or strings as callbacks
- would be nice: `if` and `unless` options