[jQuery] Preserving context within closure

[jQuery] Preserving context within closure

Hi guys,
My friend has had some trouble signing up for this list, so he asked
me to forward this question while he tries to get his signup sorted
out:
// start quote
Is there any standardized way to preserve context when setting
callbacks within an object's method? Here's how I see it is done now:
function Editor() { // class Editor
var self = this;
$(document).ready(function() { self.doSomething(); });
}
Here's how I think it could be improved:
function Editor() { // class Editor
$(document).ready(function(ctx
) { ctx.doSomething(); }, this);
}
Do you see what I mean?
Thanks in advance,
--Jonas Galvez
// end quote
thanks,
-Pat
--
ᗷɭoℊẚᗰսɳᑯѲ⁈⁈⁈
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/