/** * 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 base and optional definition. * @param function a base function to copy from. * @param array additional definition * @param function return a new function with definition from both * base and definition. */ Class.extend = function(base, definition) { var component = Class.create(); Object.extend(component.prototype, base.prototype); if(definition) Object.extend(component.prototype, definition); return component; }