News for hackers. Stuff that matters.
Re:Why jQuery.proxy rocks my world by mrspeaker on Wednesday April 27, 2011 @06:00AM (#2488939)
I prefer to just use a closure - but that just might be because I've used them so long that my brain thinks it looks nicer.

Another nice context-setting trick is to set the context manually when you do ajax requests - then callbacks will have the context of the object you did the request in:

  var myobj = {
    done: "I'm done.",
    load: function(){
      $.ajax({
        context: this,
        success: function(){
          alert(this.done);
        }
      });
    }
  };
Re:Why jQuery.proxy rocks my world by makuchaku on Wednesday April 27, 2011 @06:14AM (#2488963)
Hmm... Nice idea. But what if the closure is to be called from somewhere else as well?