Hello,
Is there a way to make class methods behave like ones (re?)created with jQuery.proxy(), automatically?
You may call me stubborn-c++'er, but I really hate how "this" is handled in JavaScript, and that explicit "this" binding is annoying, and bug-prone.
Currently I have code similar to:
PageComment = function()
{
//something something
//yes, I hate JS closure-style code also :)
this.onBackButtonClicked = $.proxy(this.onBackButtonClicked, this);
this.onSubmitButtonClicked = $.proxy(this.onSubmitButtonClicked, this);
//... and much more...
}
Maybe there is way to declare methods that are pre-proxy'ed? What techniques do you use when handling events in class methods? If there is no implicit way to do that, may be this could be a feature request?
Thank you.