Added setup_props function to prepare for adding multiple properties to generated classes
parent
a083313538
commit
9dc025e6b1
21
lib/class.js
21
lib/class.js
|
@ -182,7 +182,7 @@ function extend()
|
|||
prototype.parent = base.prototype;
|
||||
|
||||
// set up the new class
|
||||
attach_extend( new_class );
|
||||
setup_props( new_class );
|
||||
new_class.prototype = prototype;
|
||||
new_class.constructor = new_class;
|
||||
|
||||
|
@ -191,11 +191,24 @@ function extend()
|
|||
|
||||
|
||||
/**
|
||||
* Attaches extend method to the given function's prototype
|
||||
* Sets up common properties for the provided function (class)
|
||||
*
|
||||
* @param {Function} func function to attach method to
|
||||
* @param {Function} func function (class) to attach properties to
|
||||
*
|
||||
* @return undefined
|
||||
* @return {undefined}
|
||||
*/
|
||||
function setup_props( func )
|
||||
{
|
||||
attach_extend( func );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attaches extend method to the given function (class)
|
||||
*
|
||||
* @param {Function} func function (class) to attach method to
|
||||
*
|
||||
* @return {undefined}
|
||||
*/
|
||||
function attach_extend( func )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue