1 回答

TA贡献1851条经验 获得超5个赞
(function (factory) {
'use strict';
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define("utils.ClassUtil",[], factory);
} else {
// Browser globals
factory(this.jQuery);
}
}).call(this, function ($) {
/**
* @summary 寄生组合式继承
* @param subType 子类
* @param superType 超类
* @memberof ClassUtil
*/
function inheritPrototype(subType, superType) {
var prototype = object(superType.prototype);
prototype.constructor = subType;
subType.prototype = prototype;
}
/**
* @summary 返回构造函数
* @memberof ClassUtil
*/
function object(o) {
function F() { }
F.prototype = o;
return new F();
}
var exports = {
inheritPrototype: inheritPrototype
}
this.utils = this.utils || {};
this.utils.ClassUtil = exports;
return exports;
});
添加回答
举报