uxebu/bonsai — pull request #1 by padolsey (2012-07-09 13:28:11+00:00)
Title: Making callbacks consistent

These commits fix the callback ambiguity we had across the project. All callbacks are now using the single-callback pattern used in node.js:

```js
foo(function(err, data) {
if (err) // error
else // success
});
```

In addition the argument patterns used in `Movie`, `Video`, `Bitmap` and `FontFamily` have now been aligned. A convenience callback argument can be used (with the above pattern) or you can simply bind to the `load` and `success` events:

```js
new Bitmap(url).on('load', function(){ ... });
```

Before, this might not have worked if the bitmap loaded immediately from cache. The `load` event would be fired before instantiation completed, meaning that listening for it after that would be pointless.

But now, using a new `asyncEmit` method on the EventEmitter, we now trigger these events asynchronously. I'm not sure if we want there to be a method especially for this or if we should inline the `setTimeout` in relevant places. Up for discussion on that.