日期:2014-05-16 浏览次数:20377 次
var $class = (function(){
var guid = 0,
classMap = {},
caller = null,
callStack = [];
return {
create : createClass
}
//------------------------[辅助函数部分]------------------------
/**
* 创建新类.
* @param {constructor}superClass 超类构造器,该类必须由$class.create创建
* @param {Json}proto 类原型
* @return {constructor}
*/
function createClass(superClass, proto){
var isSuperValid = superClass instanceof Function
&& superClass.prototype
&& superClass.prototype.init instanceof Function;
superClass = isSuperValid ? superClass : null;
var superProto = superClass ? superClass.prototype : null;
//定义类构造函数
var klass = function() {
var args = [].slice.call(arguments);
//执行父类构造函数.
if(superClass){ &nb