var mObject = function() { this.constructor(); }; mObject.prototype = { constructor : function() { }, constructed : function() { }, callParent : function() { var method = this.callParent.caller; if (!method.$owner) { method = method.caller; } var parentClass = method.$owner.superclass, methodName = method.$name; return parentClass[methodName].apply(this, arguments); } }; classMethods = { implement : function(members) {alert("1")}, each : function(obj, action) {alert("2")} }; apply = function(object, config) { if (object && config && typeof config === 'object') { for ( var i in config) { object[i] = config[i]; } } return object; }; apply(mObject, classMethods); //mObject.each(); var o=new mObject(); o.each(); console.log(mObject); |
|