dperini/ContentLoaded — Issue #2: Allow callback to specify what to use for "this"
Author: ryandesign
Created: 2012-01-28 12:47:50+00:00
State: open

Thanks for ContentLoaded! It looks like exactly what I'm looking for, as I try to rid a [canvas library I'm developing](http://canviz.org/) from its dependency on Prototype.js.

However, my library is object-oriented, and I want to let my users create objects that can call a callback when the DOM is ready. Basically I want to be able to specify what to bind "this" to when ContentLoaded calls the callback; currently it always binds "this" to the window object that's supplied in the first parameter.

Here's a [simple patch](https://gist.github.com/1694157) that seems to work, along with an example showing how I would be using this feature. Does this seem reasonable to you?