blob: 53856684afad7bf8cff24bdbdff0761a64c1cfa7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/**
* 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;
}
|