|
@@ -279,12 +279,16 @@ var rtl = {
|
|
// if root is a "function" then c.$ancestor === c.__proto__, Object.getPrototypeOf(c) returns the root
|
|
// if root is a "function" then c.$ancestor === c.__proto__, Object.getPrototypeOf(c) returns the root
|
|
} else {
|
|
} else {
|
|
c = {};
|
|
c = {};
|
|
- c.$create = function(fnname,args){
|
|
|
|
|
|
+ c.$create = function(fn,args){
|
|
if (args == undefined) args = [];
|
|
if (args == undefined) args = [];
|
|
var o = Object.create(this);
|
|
var o = Object.create(this);
|
|
o.$init();
|
|
o.$init();
|
|
try{
|
|
try{
|
|
- o[fnname].apply(o,args);
|
|
|
|
|
|
+ if (typeof(fn)==="string"){
|
|
|
|
+ o[fn].apply(o,args);
|
|
|
|
+ } else {
|
|
|
|
+ fn.apply(o,args);
|
|
|
|
+ };
|
|
o.AfterConstruction();
|
|
o.AfterConstruction();
|
|
} catch($e){
|
|
} catch($e){
|
|
// do not call BeforeDestruction
|
|
// do not call BeforeDestruction
|
|
@@ -308,17 +312,21 @@ var rtl = {
|
|
// If newinstancefnname is given, use that function to create the new object.
|
|
// If newinstancefnname is given, use that function to create the new object.
|
|
// If exist call BeforeDestruction and AfterConstruction.
|
|
// If exist call BeforeDestruction and AfterConstruction.
|
|
var c = Object.create(ancestor);
|
|
var c = Object.create(ancestor);
|
|
- c.$create = function(fnname,args){
|
|
|
|
|
|
+ c.$create = function(fn,args){
|
|
if (args == undefined) args = [];
|
|
if (args == undefined) args = [];
|
|
var o = null;
|
|
var o = null;
|
|
if (newinstancefnname.length>0){
|
|
if (newinstancefnname.length>0){
|
|
- o = this[newinstancefnname](fnname,args);
|
|
|
|
|
|
+ o = this[newinstancefnname](fn,args);
|
|
} else {
|
|
} else {
|
|
o = Object.create(this);
|
|
o = Object.create(this);
|
|
}
|
|
}
|
|
if (o.$init) o.$init();
|
|
if (o.$init) o.$init();
|
|
try{
|
|
try{
|
|
- o[fnname].apply(o,args);
|
|
|
|
|
|
+ if (typeof(fn)==="string"){
|
|
|
|
+ o[fn].apply(o,args);
|
|
|
|
+ } else {
|
|
|
|
+ fn.apply(o,args);
|
|
|
|
+ };
|
|
if (o.AfterConstruction) o.AfterConstruction();
|
|
if (o.AfterConstruction) o.AfterConstruction();
|
|
} catch($e){
|
|
} catch($e){
|
|
// do not call BeforeDestruction
|
|
// do not call BeforeDestruction
|