On 2/28/06, Todd Ross <[EMAIL PROTECTED]> wrote:
> The plain old Function.prototype.bind() provides this exact
> functionality.  If you want to put that into bindAsEventListener, I'd
> recommend using the same variable names/techniques rather than
> reinventing them.

Well, it is basically the same technique, but it can be simplyfied a
bit, I realized

Function.prototype.bindAsEventListener = function(object) {
  var __method = this;
  var args = $A(arguments);
  args[0] = null;
  return function(event) {
    args[0] = event || window.event;
    return __method.apply(object, args);
  }
}
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to