getsentry/raven-js — pull request #84 by bisrael (2013-03-13 20:50:59+00:00)
Title: RFC: Add Events to Raven

*Please do not accept this pull request yet*

This adds a `Raven.on` and `Raven.off` function.

The use is almost exactly what it is for [backbone.js](http://backbonejs.org/#Events):
(? denotes optional parameters)

```javascript
Raven.on(eventType, callback, context?)
Raven.off(eventType?, callback?, context?)
```

Right now, I'm triggering three events:
- handle: triggers as Raven gets called from TraceKit to handle an error
- arguments passed to callback: (stackInfo, options)
- success: triggers when Raven has successfully reported an error to sentry
- arguments passed to callback: (data, src)
- failure: triggers when Raven tried to report an error, but got back an bad response code.
- arguments passed to callback: (data, src)

Discussion Points:
- Callback Names
- Callback Arguments (I definitely do not like what i'm passing now)
- Eventing Mechanism (is it too complex?)

Relevant Issues: #81 and #83