/** * Similar to bindAsEventLister, but takes additional arguments. */ Function.prototype.bindEvent = function() { var __method = this, args = $A(arguments), object = args.shift(); return function(event) { return __method.apply(object, [event || window.event].concat(args)); } } /** * Creates a new function by copying function definition from * the <tt>base</tt> and optional <tt>definition</tt>. * @param function a base function to copy from. * @param array additional definition * @param function return a new function with definition from both * <tt>base</tt> and <tt>definition</tt>. */ Class.extend = function(base, definition) { var component = Class.create(); Object.extend(component.prototype, base.prototype); if(definition) Object.extend(component.prototype, definition); return component; }