Commit 5c698a55 authored by wildfirecode13's avatar wildfirecode13

1

parents
Pipeline #280773 failed with stages
in 0 seconds
底层抽象框架
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
var ABModule = /** @class */ (function () {
function ABModule(data) {
this._data = data;
var viewClass;
if (typeof this.data.viewClass === 'string') {
viewClass = eval(this.data.viewClass);
}
else {
viewClass = this.data.viewClass;
}
this._view = new viewClass();
}
Object.defineProperty(ABModule.prototype, "data", {
/**
* 模块数据
* @returns {IModuleData}
*/
get: function () {
return this._data;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ABModule.prototype, "view", {
/**
* 视图
* @returns {any}
*/
get: function () {
return this._view;
},
enumerable: true,
configurable: true
});
return ABModule;
}());
exports.ABModule = ABModule;
//# sourceMappingURL=ABModule.js.map
\ No newline at end of file
{"version":3,"file":"ABModule.js","sourceRoot":"","sources":["../../src/component/ABModule.ts"],"names":[],"mappings":";;AAGA;;;GAGG;AACH;IAWI,kBAAY,IAAiB;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,IAAI,SAAc,CAAC;QACnB,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE;YACzC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACzC;aAAM;YACH,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;SACnC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;IACjC,CAAC;IA2DD,sBAAW,0BAAI;QAJf;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;;;OAAA;IAMD,sBAAc,0BAAI;QAJlB;;;WAGG;aACH;YACI,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;;;OAAA;IACL,eAAC;AAAD,CAAC,AA3FD,IA2FC;AA3FqB,4BAAQ"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
*Created by cuiliqiang on 2018/3/13
* 布局枚举
*/
var LayoutType;
(function (LayoutType) {
LayoutType[LayoutType["TOP"] = 0] = "TOP";
LayoutType[LayoutType["BOTTOM"] = 1] = "BOTTOM";
LayoutType[LayoutType["LEFT"] = 2] = "LEFT";
LayoutType[LayoutType["RIGHT"] = 3] = "RIGHT";
LayoutType[LayoutType["HORIZONTAL"] = 4] = "HORIZONTAL";
LayoutType[LayoutType["VERTICAL"] = 5] = "VERTICAL";
})(LayoutType = exports.LayoutType || (exports.LayoutType = {}));
//# sourceMappingURL=LayoutType.js.map
\ No newline at end of file
{"version":3,"file":"LayoutType.js","sourceRoot":"","sources":["../../src/enum/LayoutType.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,IAAY,UAOX;AAPD,WAAY,UAAU;IAClB,yCAAO,CAAA;IACP,+CAAM,CAAA;IACN,2CAAI,CAAA;IACJ,6CAAK,CAAA;IACL,uDAAU,CAAA;IACV,mDAAQ,CAAA;AACZ,CAAC,EAPW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAOrB"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
*Created by cuiliqiang on 2018/3/16
* 模块类型
*/
var ModuleType;
(function (ModuleType) {
ModuleType[ModuleType["SCENE"] = 0] = "SCENE";
ModuleType[ModuleType["PANEL"] = 1] = "PANEL";
})(ModuleType = exports.ModuleType || (exports.ModuleType = {}));
//# sourceMappingURL=ModuleType.js.map
\ No newline at end of file
{"version":3,"file":"ModuleType.js","sourceRoot":"","sources":["../../src/enum/ModuleType.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,6CAAS,CAAA;IACT,6CAAK,CAAA;AACT,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
*Created by cuiliqiang on 2018/3/15
* 资源加载优先级
*/
var ResPriority;
(function (ResPriority) {
ResPriority[ResPriority["PRE"] = 0] = "PRE";
ResPriority[ResPriority["NOMARL"] = 1] = "NOMARL";
ResPriority[ResPriority["DELAY"] = 2] = "DELAY";
})(ResPriority = exports.ResPriority || (exports.ResPriority = {}));
//# sourceMappingURL=ResPriority.js.map
\ No newline at end of file
{"version":3,"file":"ResPriority.js","sourceRoot":"","sources":["../../src/enum/ResPriority.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,2CAAO,CAAA;IACP,iDAAM,CAAA;IACN,+CAAK,CAAA;AACT,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
*Created by cuiliqiang on 2018/3/26
* 时间格式
*/
var TimeFormat;
(function (TimeFormat) {
TimeFormat["HMS"] = "hms";
TimeFormat["DHMS"] = "dhms";
})(TimeFormat = exports.TimeFormat || (exports.TimeFormat = {}));
//# sourceMappingURL=TimeFormat.js.map
\ No newline at end of file
{"version":3,"file":"TimeFormat.js","sourceRoot":"","sources":["../../src/enum/TimeFormat.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,yBAAW,CAAA;IACX,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GLang_1 = require("./util/GLang");
exports.GLang = GLang_1.GLang;
var GTime_1 = require("./util/GTime");
exports.GTime = GTime_1.GTime;
var GPool_1 = require("./util/GPool");
exports.GPool = GPool_1.GPool;
var GMath_1 = require("./util/GMath");
exports.GMath = GMath_1.GMath;
var GFun_1 = require("./util/GFun");
exports.GFun = GFun_1.GFun;
exports.getImgURL = GFun_1.getImgURL;
var GDispatcher_1 = require("./util/GDispatcher");
exports.GDispatcher = GDispatcher_1.GDispatcher;
var GConsole_1 = require("./util/GConsole");
exports.GConsole = GConsole_1.GConsole;
var GCache_1 = require("./util/GCache");
exports.GCache = GCache_1.GCache;
var ABPanelManager_1 = require("./manager/ABPanelManager");
exports.ABPanelManager = ABPanelManager_1.ABPanelManager;
var TimeFormat_1 = require("./enum/TimeFormat");
exports.TimeFormat = TimeFormat_1.TimeFormat;
var ResPriority_1 = require("./enum/ResPriority");
exports.ResPriority = ResPriority_1.ResPriority;
var ModuleType_1 = require("./enum/ModuleType");
exports.ModuleType = ModuleType_1.ModuleType;
var LayoutType_1 = require("./enum/LayoutType");
exports.LayoutType = LayoutType_1.LayoutType;
var ABModule_1 = require("./component/ABModule");
exports.ABModule = ABModule_1.ABModule;
var ABAnimationManager_1 = require("./manager/ABAnimationManager");
exports.ABAnimationManager = ABAnimationManager_1.ABAnimationManager;
var ABAudioManager_1 = require("./manager/ABAudioManager");
exports.ABAudioManager = ABAudioManager_1.ABAudioManager;
var ABResManager_1 = require("./manager/ABResManager");
exports.ABResManager = ABResManager_1.ABResManager;
var ABSceneManager_1 = require("./manager/ABSceneManager");
exports.ABSceneManager = ABSceneManager_1.ABSceneManager;
var ABStageManager_1 = require("./manager/ABStageManager");
exports.ABStageManager = ABStageManager_1.ABStageManager;
var ABDataManager_1 = require("./manager/ABDataManager");
exports.ABDataManager = ABDataManager_1.ABDataManager;
var ABModuleManager_1 = require("./manager/ABModuleManager");
exports.ABModuleManager = ABModuleManager_1.ABModuleManager;
var ABNetManager_1 = require("./manager/ABNetManager");
exports.ABNetManager = ABNetManager_1.ABNetManager;
var ABVideoManager_1 = require("./manager/ABVideoManager");
exports.ABVideoManager = ABVideoManager_1.ABVideoManager;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AAgCO,gBAhCnC,aAAK,CAgCmC;AA9BjD,sCAAqC;AA8BA,gBA9B5B,aAAK,CA8B4B;AA7B1C,sCAAqC;AA6BP,gBA7BrB,aAAK,CA6BqB;AA5BnC,sCAAqC;AA4Bd,gBA5Bd,aAAK,CA4Bc;AA3B5B,oCAA6C;AA2B5B,eA3BR,WAAI,CA2BQ;AAA6B,oBA3BpC,gBAAS,CA2BoC;AA1B3D,kDAAiD;AA0B7C,sBA1BK,yBAAW,CA0BL;AAzBf,4CAA2C;AAwB+C,mBAxBjF,mBAAQ,CAwBiF;AAvBlG,wCAAuC;AAuB2C,iBAvBzE,eAAM,CAuByE;AAtBxF,2DAA0D;AAsBtD,yBAtBK,+BAAc,CAsBL;AAnBlB,gDAA+C;AAiBI,qBAjB1C,uBAAU,CAiB0C;AAhB7D,kDAAiD;AAgBX,sBAhB7B,yBAAW,CAgB6B;AAfjD,gDAA+C;AAerB,qBAfjB,uBAAU,CAeiB;AAdpC,gDAA+C;AAcjC,qBAdL,uBAAU,CAcK;AAbxB,iDAAgD;AAa5C,mBAbK,mBAAQ,CAaL;AAXZ,mEAAkE;AAYjD,6BAZR,uCAAkB,CAYQ;AAXnC,2DAA0D;AAWrB,yBAX5B,+BAAc,CAW4B;AAVnD,uDAAsD;AAWlC,uBAXX,2BAAY,CAWW;AAVhC,2DAA0D;AAUxB,yBAVzB,+BAAc,CAUyB;AAThD,2DAA0D;AASR,yBATzC,+BAAc,CASyC;AARhE,yDAAwD;AAOH,wBAP5C,6BAAa,CAO4C;AANlE,6DAA4D;AAMQ,0BAN3D,iCAAe,CAM2D;AALnF,uDAAsD;AAK+B,uBAL5E,2BAAY,CAK4E;AAJjG,2DAA0D;AAKQ,yBALzD,+BAAc,CAKyD"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IData.js.map
\ No newline at end of file
{"version":3,"file":"IData.js","sourceRoot":"","sources":["../../src/interface/IData.ts"],"names":[],"mappings":""}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IDestroy.js.map
\ No newline at end of file
{"version":3,"file":"IDestroy.js","sourceRoot":"","sources":["../../src/interface/IDestroy.ts"],"names":[],"mappings":""}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IModuleData.js.map
\ No newline at end of file
{"version":3,"file":"IModuleData.js","sourceRoot":"","sources":["../../src/interface/IModuleData.ts"],"names":[],"mappings":""}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=INetData.js.map
\ No newline at end of file
{"version":3,"file":"INetData.js","sourceRoot":"","sources":["../../src/interface/INetData.ts"],"names":[],"mappings":""}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* 动画管理器
*/
var ABAnimationManager = /** @class */ (function () {
function ABAnimationManager() {
}
return ABAnimationManager;
}());
exports.ABAnimationManager = ABAnimationManager;
//# sourceMappingURL=ABAnimationManager.js.map
\ No newline at end of file
{"version":3,"file":"ABAnimationManager.js","sourceRoot":"","sources":["../../src/manager/ABAnimationManager.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH;IAAA;IAMA,CAAC;IAAD,yBAAC;AAAD,CAAC,AAND,IAMC;AANqB,gDAAkB"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ABAudioManager = /** @class */ (function () {
function ABAudioManager() {
}
return ABAudioManager;
}());
exports.ABAudioManager = ABAudioManager;
//# sourceMappingURL=ABAudioManager.js.map
\ No newline at end of file
{"version":3,"file":"ABAudioManager.js","sourceRoot":"","sources":["../../src/manager/ABAudioManager.ts"],"names":[],"mappings":";;AAAA;IACI;IAEA,CAAC;IA+DL,qBAAC;AAAD,CAAC,AAlED,IAkEC;AAlEqB,wCAAc"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
*Created by cuiliqiang on 2018/3/8
* 数据管理
*/
var ABDataManager = /** @class */ (function () {
function ABDataManager() {
}
return ABDataManager;
}());
exports.ABDataManager = ABDataManager;
//# sourceMappingURL=ABDataManager.js.map
\ No newline at end of file
{"version":3,"file":"ABDataManager.js","sourceRoot":"","sources":["../../src/manager/ABDataManager.ts"],"names":[],"mappings":";;AAAA;;;GAGG;AACH;IAAA;IAQA,CAAC;IAAD,oBAAC;AAAD,CAAC,AARD,IAQC;AARqB,sCAAa"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* 模块管理器
*/
var ABModuleManager = /** @class */ (function () {
function ABModuleManager() {
}
return ABModuleManager;
}());
exports.ABModuleManager = ABModuleManager;
//# sourceMappingURL=ABModuleManager.js.map
\ No newline at end of file
{"version":3,"file":"ABModuleManager.js","sourceRoot":"","sources":["../../src/manager/ABModuleManager.ts"],"names":[],"mappings":";;AAEA;;GAEG;AACH;IAAA;IA2BA,CAAC;IAAD,sBAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BqB,0CAAe"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GTime_1 = require("../util/GTime");
var ABNetManager = /** @class */ (function () {
function ABNetManager() {
/**
* 调用接口对象池
*/
this.callbackPool = {};
}
/**
* 发送请求
* @param net
*/
ABNetManager.prototype.send = function (net) {
var _this = this;
var gTime = '?_=' + GTime_1.GTime.getTimestamp();
var realUrl = net.uri;
if (realUrl.indexOf('?') != -1) {
gTime = '&_=' + GTime_1.GTime.getTimestamp();
}
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if (net.addUrl) {
realUrl += net.addUrl;
}
window['$'].ajax({
type: net.type,
// url: realUrl + gTime,
url: realUrl,
dataType: net.dataType,
data: net.param,
async: true,
success: function (result) {
_this.onResponse(net, result);
//console.log(`[${net.uri}]${JSON.stringify(result)}`)
},
error: function (message) {
_this.onError(net);
}
});
};
/**
* 接口底层错误
*/
ABNetManager.ERROR = 'Error';
return ABNetManager;
}());
exports.ABNetManager = ABNetManager;
//# sourceMappingURL=ABNetManager.js.map
\ No newline at end of file
{"version":3,"file":"ABNetManager.js","sourceRoot":"","sources":["../../src/manager/ABNetManager.ts"],"names":[],"mappings":";;AACA,uCAAsC;AAGtC;IAWI;QALA;;WAEG;QACK,iBAAY,GAAQ,EAAE,CAAC;IAG/B,CAAC;IAED;;;OAGG;IACI,2BAAI,GAAX,UAAY,GAAa;QAAzB,iBA2BC;QA1BG,IAAI,KAAK,GAAW,KAAK,GAAG,aAAK,CAAC,YAAY,EAAE,CAAC;QACjD,IAAI,OAAO,GAAW,GAAG,CAAC,GAAG,CAAC;QAC9B,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE;YAC5B,KAAK,GAAG,KAAK,GAAG,aAAK,CAAC,YAAY,EAAE,CAAC;SACxC;QAED,yCAAyC;QACzC,IAAI,GAAG,CAAC,MAAM,EAAE;YACZ,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC;SACzB;QAED,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,wBAAwB;YACxB,GAAG,EAAE,OAAO;YACZ,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,IAAI,EAAE,GAAG,CAAC,KAAK;YACf,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,UAAC,MAAM;gBACZ,KAAI,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;gBAC7B,sDAAsD;YAC1D,CAAC;YACD,KAAK,EAAE,UAAC,OAAO;gBACX,KAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IA5CD;;OAEG;IACW,kBAAK,GAAG,OAAO,CAAC;IAuDlC,mBAAC;CAAA,AA3DD,IA2DC;AA3DqB,oCAAY"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* 面板管理
*/
var ABPanelManager = /** @class */ (function () {
function ABPanelManager() {
}
return ABPanelManager;
}());
exports.ABPanelManager = ABPanelManager;
//# sourceMappingURL=ABPanelManager.js.map
\ No newline at end of file
{"version":3,"file":"ABPanelManager.js","sourceRoot":"","sources":["../../src/manager/ABPanelManager.ts"],"names":[],"mappings":";;AAEA;;GAEG;AACH;IAEI;IACA,CAAC;IA6BL,qBAAC;AAAD,CAAC,AAhCD,IAgCC;AAhCqB,wCAAc"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ABResManager = /** @class */ (function () {
function ABResManager() {
}
return ABResManager;
}());
exports.ABResManager = ABResManager;
//# sourceMappingURL=ABResManager.js.map
\ No newline at end of file
{"version":3,"file":"ABResManager.js","sourceRoot":"","sources":["../../src/manager/ABResManager.ts"],"names":[],"mappings":";;AAEA;IAAA;IAmBA,CAAC;IAAD,mBAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBqB,oCAAY"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* 场景管理器
*/
var ABSceneManager = /** @class */ (function () {
function ABSceneManager() {
}
return ABSceneManager;
}());
exports.ABSceneManager = ABSceneManager;
//# sourceMappingURL=ABSceneManager.js.map
\ No newline at end of file
{"version":3,"file":"ABSceneManager.js","sourceRoot":"","sources":["../../src/manager/ABSceneManager.ts"],"names":[],"mappings":";;AACA;;GAEG;AACH;IACI;IACA,CAAC;IAqBL,qBAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBqB,wCAAc"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ABStageManager = /** @class */ (function () {
function ABStageManager() {
}
return ABStageManager;
}());
exports.ABStageManager = ABStageManager;
//# sourceMappingURL=ABStageManager.js.map
\ No newline at end of file
{"version":3,"file":"ABStageManager.js","sourceRoot":"","sources":["../../src/manager/ABStageManager.ts"],"names":[],"mappings":";;AAEA;IAAA;IAsBA,CAAC;IAAD,qBAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBqB,wCAAc"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ABVideoManager = /** @class */ (function () {
function ABVideoManager() {
}
return ABVideoManager;
}());
exports.ABVideoManager = ABVideoManager;
//# sourceMappingURL=ABVideoManager.js.map
\ No newline at end of file
{"version":3,"file":"ABVideoManager.js","sourceRoot":"","sources":["../../src/manager/ABVideoManager.ts"],"names":[],"mappings":";;AAAA;IAAA;IAmCA,CAAC;IAAD,qBAAC;AAAD,CAAC,AAnCD,IAmCC;AAnCqB,wCAAc"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GFun_1 = require("./GFun");
var GConsole_1 = require("./GConsole");
var GCache = /** @class */ (function () {
function GCache() {
}
/**
* 初始化
* @param keys
*/
GCache.init = function (keys) {
var i = 0;
var len = keys.length;
this.gKey = '';
for (i; i < len; i++) {
this.gKey += '_' + keys[i];
}
};
/**
* 写入缓存
* @param key
* @param value
* @param type type 缓存类型 localStorage永久缓存 sessionStorage浏览器生命周期结束前'
*/
GCache.writeCache = function (key, value, type) {
if (type === void 0) { type = 'localStorage'; }
if (!window[type]) {
GConsole_1.GConsole.log(GFun_1.GFun.replace('webview不支持{0}', [type]));
return;
}
window[type].setItem(key + this.gKey, value);
};
/**
* 读取缓存
* @param key
* @param type type 缓存类型 localStorage永久缓存 sessionStorage浏览器生命周期结束前'
* @return
*/
GCache.readCache = function (key, type) {
if (type === void 0) { type = 'localStorage'; }
if (!window[type]) {
GConsole_1.GConsole.log(GFun_1.GFun.replace('webview不支持{0}', [type]));
return;
}
return window[type].getItem(key + this.gKey);
};
/**
* 删除缓存
* @param key
* @param type 缓存类型 localStorage永久缓存 sessionStorage浏览器生命周期结束前
*/
GCache.removeCache = function (key, type) {
if (type === void 0) { type = 'localStorage'; }
if (!window[type]) {
GConsole_1.GConsole.log(GFun_1.GFun.replace('webview不支持{0}', [type]));
return;
}
window[type].removeItem(key + this.gKey);
};
return GCache;
}());
exports.GCache = GCache;
//# sourceMappingURL=GCache.js.map
\ No newline at end of file
{"version":3,"file":"GCache.js","sourceRoot":"","sources":["../../src/util/GCache.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,uCAAsC;AAEtC;IAAA;IAwDA,CAAC;IArDG;;;OAGG;IACW,WAAI,GAAlB,UAAmB,IAAc;QAC7B,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAM,GAAG,GAAW,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YAClB,IAAI,CAAC,IAAI,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;SAC9B;IACL,CAAC;IAED;;;;;OAKG;IACW,iBAAU,GAAxB,UAAyB,GAAW,EAAE,KAAU,EAAE,IAAqB;QAArB,qBAAA,EAAA,qBAAqB;QACnE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACf,mBAAQ,CAAC,GAAG,CAAC,WAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO;SACV;QACD,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACW,gBAAS,GAAvB,UAAwB,GAAW,EAAE,IAAqB;QAArB,qBAAA,EAAA,qBAAqB;QACtD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACf,mBAAQ,CAAC,GAAG,CAAC,WAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO;SACV;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACW,kBAAW,GAAzB,UAA0B,GAAW,EAAE,IAAqB;QAArB,qBAAA,EAAA,qBAAqB;QACxD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YACf,mBAAQ,CAAC,GAAG,CAAC,WAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpD,OAAO;SACV;QACD,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IACL,aAAC;AAAD,CAAC,AAxDD,IAwDC;AAxDY,wBAAM"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GConsole = /** @class */ (function () {
function GConsole() {
}
/**
* 日志打印
* @param args
*/
GConsole.log = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!this.switch) {
return;
}
var i = 0;
var len = args.length;
for (i; i < len; i++) {
console.log(args[i]);
}
};
GConsole.switch = window['debug'] || true;
return GConsole;
}());
exports.GConsole = GConsole;
//# sourceMappingURL=GConsole.js.map
\ No newline at end of file
{"version":3,"file":"GConsole.js","sourceRoot":"","sources":["../../src/util/GConsole.ts"],"names":[],"mappings":";;AAAA;IAAA;IAgBA,CAAC;IAdG;;;OAGG;IACW,YAAG,GAAjB;QAAkB,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,yBAAO;;QACrB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACd,OAAO;SACV;QACD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,IAAM,GAAG,GAAW,IAAI,CAAC,MAAM,CAAC;QAChC,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB;IACL,CAAC;IAdc,eAAM,GAAY,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;IAe7D,eAAC;CAAA,AAhBD,IAgBC;AAhBY,4BAAQ"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GDispatcher = /** @class */ (function () {
function GDispatcher() {
}
/**
*
* @param name 事件名
* @param callback 回调
* @param thisObj 作用域
*/
GDispatcher.addEvent = function (name, callback, thisObj) {
if (!this.callbackPool[name]) {
this.callbackPool[name] = [];
this.thisObjPool[name] = [];
}
var index = this.callbackPool[name].indexOf(callback);
if (index != -1) {
this.callbackPool[name][index] = callback;
this.thisObjPool[name][index] = thisObj;
}
else {
this.callbackPool[name].push(callback);
this.thisObjPool[name].push(thisObj);
}
};
/**
*
* @param name 事件名
* @param callback 回调
* @param thisObj 作用域
*/
GDispatcher.removeEvent = function (name, callback, thisObj) {
if (this.callbackPool[name]) {
var index = this.callbackPool[name].indexOf(callback);
if (index != -1) {
this.callbackPool[name].splice(index, 1);
this.thisObjPool[name].splice(index, 1);
}
}
};
/**
* 派发事件
* @param name 事件名
* @param args 任意参数
*/
GDispatcher.dispatchEvent = function (name) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var callbacks = this.callbackPool[name];
var thisObjs = this.thisObjPool[name];
if (callbacks) {
var i = 0;
var len = callbacks.length;
for (i; i < len; i++) {
callbacks[i].apply(thisObjs[i], args);
}
}
};
/**
* 事件回调池
*/
GDispatcher.callbackPool = {};
/**
* 事件作用域池
*/
GDispatcher.thisObjPool = {};
return GDispatcher;
}());
exports.GDispatcher = GDispatcher;
//# sourceMappingURL=GDispatcher.js.map
\ No newline at end of file
{"version":3,"file":"GDispatcher.js","sourceRoot":"","sources":["../../src/util/GDispatcher.ts"],"names":[],"mappings":";;AAAA;IAAA;IAiEA,CAAC;IAtDG;;;;;OAKG;IACW,oBAAQ,GAAtB,UAAuB,IAAY,EAAE,QAAQ,EAAE,OAAY;QACvD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SAC/B;QAED,IAAM,KAAK,GAAW,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAChE,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;YACb,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;YAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;SAC3C;aAAM;YACH,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACxC;IACL,CAAC;IAED;;;;;OAKG;IACW,uBAAW,GAAzB,UAA0B,IAAY,EAAE,QAAQ,EAAE,OAAa;QAC3D,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;YACzB,IAAM,KAAK,GAAW,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChE,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;gBACb,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBACzC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;aAC3C;SACJ;IACL,CAAC;IAED;;;;OAIG;IACW,yBAAa,GAA3B,UAA4B,IAAY;QAAE,cAAO;aAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;YAAP,6BAAO;;QAC7C,IAAM,SAAS,GAAe,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACtD,IAAM,QAAQ,GAAQ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,SAAS,EAAE;YACX,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,IAAM,GAAG,GAAW,SAAS,CAAC,MAAM,CAAC;YACrC,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;gBAClB,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aACzC;SACJ;IACL,CAAC;IA/DD;;OAEG;IACY,wBAAY,GAAQ,EAAE,CAAC;IAEtC;;OAEG;IACY,uBAAW,GAAQ,EAAE,CAAC;IAwDzC,kBAAC;CAAA,AAjED,IAiEC;AAjEY,kCAAW"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GFun = /** @class */ (function () {
function GFun() {
}
/**
* 加载 html Image
* @param url
* @param callback
*/
GFun.loadImage = function (url, callback) {
//取出跟url匹配的Image
var bitmapData = new Image();
bitmapData.onload = function (e) {
if (callback) {
callback(bitmapData);
}
};
bitmapData.src = url;
};
/**
* 替换字符串中元素
* @param str
* @param replaceList
*/
GFun.replace = function (str, replaceList) {
var len = replaceList.length;
for (var i = 0; i < len; i++) {
str = str.replace("{" + i + "}", replaceList[i].toString());
}
return str;
};
/**
* 是否在app内运行
* @param strs 匹配字符串
*/
GFun.checkInApp = function (strs) {
var ua = navigator.userAgent.toLocaleLowerCase();
var i;
var len = strs.length;
for (i = 0; i < len; i++) {
if (ua.indexOf(strs[i]) != -1) {
return true;
}
}
return false;
};
Object.defineProperty(GFun, "isIOS", {
/**
* 判断操作系统
* @returns {Array|{index: number, input: string}}
*/
get: function () {
return navigator.userAgent.match(/iphone|ipod|ipad/gi) != null;
},
enumerable: true,
configurable: true
});
/**
* 获取url参数
*/
GFun.getQueryString = function (name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
};
return GFun;
}());
exports.GFun = GFun;
var check_webp_feature = function (callback) {
var _support_webp_ = localStorage.getItem('_support_webp_');
if (_support_webp_ !== null) {
return callback(_support_webp_ === '1');
}
var img = new Image();
img.onload = function () {
var result = (img.width > 0) && (img.height > 0);
callback(result);
localStorage.setItem('_support_webp_', result ? '1' : '0');
};
img.onerror = function () {
callback(false);
localStorage.setItem('_support_webp_', '0');
};
img.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
};
exports.getImgURL = function (url, cb) {
check_webp_feature(function (isSupport) {
if (isSupport)
url += '?x-oss-process=image/format,webp';
cb(url);
});
};
//# sourceMappingURL=GFun.js.map
\ No newline at end of file
{"version":3,"file":"GFun.js","sourceRoot":"","sources":["../../src/util/GFun.ts"],"names":[],"mappings":";;AAIA;IAAA;IAiEA,CAAC;IAhEG;;;;OAIG;IACW,cAAS,GAAvB,UAAwB,GAAW,EAAE,QAAkB;QACnD,gBAAgB;QAChB,IAAM,UAAU,GAAQ,IAAI,KAAK,EAAE,CAAC;QACpC,UAAU,CAAC,MAAM,GAAG,UAAC,CAAC;YAClB,IAAI,QAAQ,EAAE;gBACV,QAAQ,CAAC,UAAU,CAAC,CAAC;aACxB;QACL,CAAC,CAAC;QACF,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACW,YAAO,GAArB,UAAsB,GAAW,EAAE,WAAmC;QAClE,IAAM,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YAC1B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC/D;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;OAGG;IACW,eAAU,GAAxB,UAAyB,IAAc;QACnC,IAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;QACnD,IAAI,CAAS,CAAC;QACd,IAAM,GAAG,GAAW,IAAI,CAAC,MAAM,CAAC;QAChC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YACtB,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAMD,sBAAkB,aAAK;QAJvB;;;WAGG;aACH;YACI,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC;QACnE,CAAC;;;OAAA;IAED;;OAEG;IACW,mBAAc,GAA5B,UAA6B,IAAI;QAC7B,IAAM,GAAG,GAAG,IAAI,MAAM,CAAC,OAAO,GAAG,IAAI,GAAG,eAAe,EAAE,GAAG,CAAC,CAAC;QAC9D,IAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,IAAI,EAAE;YACX,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACzB;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,WAAC;AAAD,CAAC,AAjED,IAiEC;AAjEY,oBAAI;AAmEjB,IAAM,kBAAkB,GAAG,UAAC,QAAQ;IAChC,IAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9D,IAAI,cAAc,KAAK,IAAI,EAAE;QACzB,OAAO,QAAQ,CAAC,cAAc,KAAK,GAAG,CAAC,CAAA;KAC1C;IACD,IAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;IACxB,GAAG,CAAC,MAAM,GAAG;QACT,IAAM,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACnD,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjB,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAC9D,CAAC,CAAC;IACF,GAAG,CAAC,OAAO,GAAG;QACV,QAAQ,CAAC,KAAK,CAAC,CAAC;QAChB,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;IAC/C,CAAC,CAAC;IACF,GAAG,CAAC,GAAG,GAAG,iFAAiF,CAAC;AAChG,CAAC,CAAA;AAEY,QAAA,SAAS,GAAG,UAAC,GAAW,EAAE,EAAE;IACrC,kBAAkB,CAAC,UAAC,SAAS;QACzB,IAAI,SAAS;YAAE,GAAG,IAAI,kCAAkC,CAAC;QACzD,EAAE,CAAC,GAAG,CAAC,CAAA;IACX,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GLang = /** @class */ (function () {
function GLang() {
}
GLang.lang_001 = "pre资源加载完成";
GLang.lang_002 = "nomarl资源加载完成";
GLang.lang_003 = "delay资源加载完成";
return GLang;
}());
exports.GLang = GLang;
//# sourceMappingURL=GLang.js.map
\ No newline at end of file
{"version":3,"file":"GLang.js","sourceRoot":"","sources":["../../src/util/GLang.ts"],"names":[],"mappings":";;AAAA;IAAA;IAIA,CAAC;IAHiB,cAAQ,GAAG,WAAW,CAAC;IACvB,cAAQ,GAAG,cAAc,CAAC;IAC1B,cAAQ,GAAG,aAAa,CAAC;IAC3C,YAAC;CAAA,AAJD,IAIC;AAJY,sBAAK"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var GMath = /** @class */ (function () {
function GMath() {
}
/**
* 向下取整
* @param n
* @returns {number}
*/
GMath.int = function (n) {
return n >> 0;
};
/**
* 给数组随机排序
* @param arr
*/
GMath.randomArr = function (arr) {
var len = arr.length;
for (var i = 0; i < len; i++) {
var n = this.random(0, arr.length, true);
var temp = arr[n];
arr[n] = arr[i];
arr[i] = temp;
}
return arr;
};
/**
* 范围随机数
* @param n1 范围起始
* @param n2 范围结束
* @param int 结果是否返回整数
* @return {*}
*/
GMath.random = function (n1, n2, int) {
var n;
var min;
var max;
if ((typeof n1) != 'undefined' && (typeof n2) != 'undefined') {
min = Math.min(n1, n2);
max = Math.max(n1, n2);
n = Math.random() * (max - min) + min;
}
else {
n = Math.random();
}
if (int) {
n = this.int(n);
}
return n;
};
return GMath;
}());
exports.GMath = GMath;
//# sourceMappingURL=GMath.js.map
\ No newline at end of file
{"version":3,"file":"GMath.js","sourceRoot":"","sources":["../../src/util/GMath.ts"],"names":[],"mappings":";;AAAA;IAAA;IAgDA,CAAC;IA/CG;;;;OAIG;IACW,SAAG,GAAjB,UAAkB,CAAM;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAED;;;OAGG;IACW,eAAS,GAAvB,UAAwB,GAAU;QAC9B,IAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;QACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YAC1B,IAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC3C,IAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACpB,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YAChB,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;SACjB;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACW,YAAM,GAApB,UAAqB,EAAU,EAAE,EAAU,EAAE,GAAY;QACrD,IAAI,CAAS,CAAC;QACd,IAAI,GAAW,CAAC;QAChB,IAAI,GAAW,CAAC;QAChB,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,WAAW,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,WAAW,EAAE;YAC1D,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACvB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACvB,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;SACzC;aAAM;YACH,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;SACrB;QACD,IAAI,GAAG,EAAE;YACL,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACnB;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IACL,YAAC;AAAD,CAAC,AAhDD,IAgDC;AAhDY,sBAAK"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* 对象池
*/
var GPool = /** @class */ (function () {
function GPool() {
}
/**
* 根据类型设置缓存最大个数
* @param className
* @param count
*/
GPool.setMaxCountByType = function (className, count) {
this.maxCount[className] = count;
};
/**
* 取出
* @param className 资源名
* @param 类名
*/
GPool.takeOut = function (className, classObj, isCreate) {
if (!className || className == '') {
return;
}
var obj;
if (this.pool[className] && this.pool[className].length) {
obj = this.pool[className].shift();
}
else if (isCreate) {
if (!classObj) {
classObj = eval(className);
}
obj = new classObj();
}
return obj;
};
/**
* 回收
* @param className 资源Class
* @param obj 资源
*/
GPool.recover = function (className, obj) {
if (!obj || !className) {
return;
}
if (!this.pool[className]) {
this.pool[className] = [];
}
if (!this.maxCount[className]) {
this.maxCount[className] = 100;
}
if (this.pool[className].length > this.maxCount[className]) {
return;
}
this.pool[className].push(obj);
if (obj['dispose']) {
obj.dispose();
}
};
GPool.pool = {};
GPool.maxCount = {};
return GPool;
}());
exports.GPool = GPool;
//# sourceMappingURL=GPool.js.map
\ No newline at end of file
{"version":3,"file":"GPool.js","sourceRoot":"","sources":["../../src/util/GPool.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH;IAAA;IA4DA,CAAC;IAxDG;;;;OAIG;IACW,uBAAiB,GAA/B,UAAgC,SAAc,EAAE,KAAK;QACjD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACW,aAAO,GAArB,UAAsB,SAAiB,EAAE,QAAc,EAAE,QAAkB;QACvE,IAAI,CAAC,SAAS,IAAI,SAAS,IAAI,EAAE,EAAE;YAC/B,OAAO;SACV;QACD,IAAI,GAAQ,CAAC;QAEb,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE;YACrD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,CAAC;SACtC;aAAM,IAAI,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,EAAE;gBACX,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;aAC9B;YACD,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;SACxB;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;OAIG;IACW,aAAO,GAArB,UAAsB,SAAiB,EAAE,GAAQ;QAC7C,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE;YACpB,OAAO;SACV;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;SAC7B;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;SAClC;QAED,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YACxD,OAAO;SACV;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE;YAChB,GAAG,CAAC,OAAO,EAAE,CAAC;SACjB;IACL,CAAC;IA1Dc,UAAI,GAAQ,EAAE,CAAC;IACf,cAAQ,GAAG,EAAE,CAAC;IA0DjC,YAAC;CAAA,AA5DD,IA4DC;AA5DY,sBAAK"}
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TimeFormat_1 = require("../enum/TimeFormat");
var GTime = /** @class */ (function () {
function GTime() {
}
/**
* 获取当前时间戳
* @returns {number}
*/
GTime.getTimestamp = function () {
return new Date().getTime();
};
/**
* 传入秒数返回带格式的时间
* @param time 单位秒
* @param type 枚举类型CountDownType
* @param dibit 是否双位
*/
GTime.formatTime = function (time, type, dibit, suffixs) {
if (type === void 0) { type = TimeFormat_1.TimeFormat.HMS; }
if (dibit === void 0) { dibit = false; }
if (suffixs === void 0) { suffixs = ['d', 'h', 'm', 's']; }
var countdown = this.getCountDown(time, type, dibit);
countdown = countdown.map(function (val, index) { return "" + (val < 10 ? '0' + val : val) + suffixs[index]; });
return countdown.join('');
};
/**
* 倒计时
* @param time 单位秒
* @param type 枚举类型CountDownType
* @param dibit 是否双位
*/
GTime.getCountDown = function (time, type, dibit) {
if (type === void 0) { type = TimeFormat_1.TimeFormat.HMS; }
if (dibit === void 0) { dibit = false; }
var result = [];
if (type.indexOf('s') !== -1) {
result.push(time % 60);
}
if (type.indexOf('m') !== -1) {
result.unshift(Math.floor((time % 3600) / 60));
}
if (type.indexOf('h') >= 0) {
if (type == TimeFormat_1.TimeFormat.HMS) {
result.unshift(Math.floor(time / 3600));
}
else {
result.unshift(Math.floor((time % 86400) / 3600));
}
}
if (type.indexOf('d') >= 0) {
result.unshift(Math.floor(time / 86400));
}
if (dibit)
result = result.map(function (ele) {
return ele < 10 ? "0" + ele : ele;
});
return result;
};
return GTime;
}());
exports.GTime = GTime;
//# sourceMappingURL=GTime.js.map
\ No newline at end of file
{"version":3,"file":"GTime.js","sourceRoot":"","sources":["../../src/util/GTime.ts"],"names":[],"mappings":";;AAAA,iDAAgD;AAChD;IAAA;IAwDA,CAAC;IAvDG;;;OAGG;IACW,kBAAY,GAA1B;QACI,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACW,gBAAU,GAAxB,UAAyB,IAAY,EAAE,IAA6B,EAAE,KAAa,EAAE,OAA8B;QAA5E,qBAAA,EAAA,OAAe,uBAAU,CAAC,GAAG;QAAE,sBAAA,EAAA,aAAa;QAAE,wBAAA,EAAA,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QAC/G,IAAI,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACrD,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,UAAC,GAAG,EAAE,KAAK,IAAK,OAAA,MAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAG,OAAO,CAAC,KAAK,CAAG,EAAhD,CAAgD,CAAC,CAAC;QAC5F,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACW,kBAAY,GAA1B,UAA2B,IAAY,EAAE,IAA6B,EAAE,KAAa;QAA5C,qBAAA,EAAA,OAAe,uBAAU,CAAC,GAAG;QAAE,sBAAA,EAAA,aAAa;QACjF,IAAI,MAAM,GAAU,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YAC1B,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;SAC1B;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YAC1B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;SAClD;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,IAAI,IAAI,uBAAU,CAAC,GAAG,EAAE;gBACxB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;aAC3C;iBACI;gBACD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;aACrD;SACJ;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACxB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;SAC5C;QAED,IAAI,KAAK;YACL,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAC,GAAG;gBACpB,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,MAAI,GAAK,CAAC,CAAC,CAAC,GAAG,CAAC;YACtC,CAAC,CAAC,CAAA;QACN,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,YAAC;AAAD,CAAC,AAxDD,IAwDC;AAxDY,sBAAK"}
\ No newline at end of file
{
"name": "duiba-tc",
"version": "1.0.111",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/jquery": {
"version": "3.3.5",
"resolved": "http://registry.npm.taobao.org/@types/jquery/download/@types/jquery-3.3.5.tgz",
"integrity": "sha1-dc/sjF7jg1XRQpatp+fi+4vTrC8="
}
}
}
{
"name": "duiba-tc",
"version": "1.0.112",
"description": "H5底层抽象框架",
"main": "./dist/index.js",
"types": "./types/index.d.ts",
"scripts": {},
"author": "",
"license": "ISC",
"dependencies": {
"@types/jquery": "^3.3.1"
}
}
import { IModuleData } from "../interface/IModuleData";
import { IDestroy } from "../interface/IDestroy";
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
export abstract class ABModule implements IDestroy {
/**
* 模块数据
*/
private _data: IModuleData;
/**
* 视图层
*/
private _view: any;
constructor(data: IModuleData) {
this._data = data;
let viewClass: any;
if (typeof this.data.viewClass === 'string') {
viewClass = eval(this.data.viewClass);
} else {
viewClass = this.data.viewClass;
}
this._view = new viewClass();
}
/**
* 初始化模型
*/
protected abstract initModel(): void
/**
* 初始化UI
*/
protected abstract initUI(): void
/**
* 显示
*/
protected abstract show(): void
/**
* 隐藏
*/
protected abstract hide(): void
/**
* 添加事件
*/
protected abstract addEvent(): void
/**
* 移除事件
*/
protected abstract removeEvent(): void
/**
* 更新页面
* @param args
*/
public abstract updateData(...args): void
/**
* 播放进场动画
* @param callback 回调函数
*/
public abstract playShowAnimation(callback?: Function): void
/**
* 播放退场动画
* @param callback 回调函数
*/
public abstract playHideAnimation(callback?: Function): void
/**
* 销毁
*/
public abstract dispose(): void
/**
* 模块数据
* @returns {IModuleData}
*/
public get data(): IModuleData {
return this._data;
}
/**
* 视图
* @returns {any}
*/
protected get view(): any {
return this._view;
}
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/3/13
* 布局枚举
*/
export enum LayoutType {
TOP = 0,
BOTTOM,
LEFT,
RIGHT,
HORIZONTAL,
VERTICAL
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/3/16
* 模块类型
*/
export enum ModuleType {
SCENE = 0,
PANEL,
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/3/15
* 资源加载优先级
*/
export enum ResPriority {
PRE = 0,
NOMARL,
DELAY
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/3/26
* 时间格式
*/
export enum TimeFormat {
HMS = 'hms',
DHMS = 'dhms'
}
\ No newline at end of file
import { GLang } from './util/GLang';
import { INetData } from './interface/INetData';
import { GTime } from './util/GTime';
import { GPool } from './util/GPool';
import { GMath } from './util/GMath';
import { GFun,getImgURL } from './util/GFun';
import { GDispatcher } from './util/GDispatcher';
import { GConsole } from './util/GConsole';
import { GCache } from './util/GCache';
import { ABPanelManager } from './manager/ABPanelManager';
import { IModuleData } from './interface/IModuleData';
import { IDestroy } from './interface/IDestroy';
import { TimeFormat } from './enum/TimeFormat';
import { ResPriority } from './enum/ResPriority';
import { ModuleType } from './enum/ModuleType';
import { LayoutType } from './enum/LayoutType';
import { ABModule } from "./component/ABModule";
import { IData } from './interface/IData';
import { ABAnimationManager } from './manager/ABAnimationManager';
import { ABAudioManager } from './manager/ABAudioManager';
import { ABResManager } from './manager/ABResManager';
import { ABSceneManager } from './manager/ABSceneManager';
import { ABStageManager } from './manager/ABStageManager';
import { ABDataManager } from './manager/ABDataManager';
import { ABModuleManager } from './manager/ABModuleManager';
import { ABNetManager } from './manager/ABNetManager';
import { ABVideoManager } from './manager/ABVideoManager';
export {
ABModule, LayoutType, ModuleType, ResPriority, TimeFormat, IData, IDestroy, INetData,
IModuleData, ABAnimationManager, ABAudioManager, ABDataManager, ABModuleManager, ABNetManager,
ABPanelManager, ABResManager, ABSceneManager, ABStageManager, ABVideoManager, GCache, GConsole,
GDispatcher, GFun, GMath, GPool, GTime, GLang,getImgURL
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/3/8
*/
export interface IData {
update(data: any): void
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/2/28
* 销毁
*/
export interface IDestroy {
dispose(): void;
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/3/13
* 模块数据
*/
import { ResPriority } from "../enum/ResPriority";
import { ModuleType } from "../enum/ModuleType";
export interface IModuleData {
/**
* 模块名字
*/
moduleName: string;
/**
* 模块类
*/
moduleClass: any;
/**
* 视图类
*/
viewClass: any;
/**
* 资源
*/
res: string;
/**
* 资源加载优先级
*/
resPriority: ResPriority;
/**
* 类型 1 场景, 2面板
*/
type: ModuleType;
/**
* 显示层级
*/
layerIndex: number;
/**
* 显示遮罩背景
*/
showBg: boolean;
/**
* 是否可以事件穿透
*/
eventPenetrate: boolean;
/**
* 进场动画
*/
showAnimation?: Function;
/**
* 退场动画
*/
hideAnimation?: Function;
/**
* UI配置
*/
uiCfg?: any;
}
\ No newline at end of file
export interface INetData {
//名字
name: any;
//地址
uri: string;
//接口类型 get、post等
type: string;
//返回数据类型
dataType: string;
//参数
param: any;
//回调
callback: Function;
//轮询次数
pollingCount?: number;
//轮询条件检查
pollingCheck?: Function;
//url拼接内容
addUrl?: string;
//是否显示错误提示
hideMsg?: boolean;
}
\ No newline at end of file
/**
* 动画管理器
*/
export abstract class ABAnimationManager {
/**
* 播放动画
* @param animations 动画数组
*/
public abstract play(animations: any[]): void
}
\ No newline at end of file
export abstract class ABAudioManager {
constructor() {
}
/**
* 创建声音实例
* @param {string} name 标识
* @param {string} src 音频地址
*/
public abstract createSound(name: string, src: string): void
/**
* 获取当前声音实例
* @param {string} name 标识
* @returns {any}
* @constructor
*/
public abstract getSound(name: string): any
/**
* 播放声音
* @param {string} name 标识
* @param {number} start 开始点 默认为0
* @param {number} loop 循环次数 默认为1
*/
public abstract play(name: string, start?: number, loop?: number): void
/**
* 暂停播放,或者恢复播放
* @param {string} name 标识
* @param {boolean} isPause 默认为true;是否要暂停,如果要暂停,则暂停;否则则播放
*/
public abstract pause(name: string, isPause?: boolean): void
/**
* 停止声音播放
* @param {string} name 标识
* @param {.Sound} sound 声音实例
*/
public abstract stop(name: string): void
/**
* 设置音量
* @param {string} name 标识
* @param {number} volume 音量大小,从0-1 在ios里 volume只能是0 或者1,其他无效
*/
public abstract setVolume(name: string, volume: number): void
/**
* 设置所有音频音量
* @param volume
*/
public abstract setAllVolume(volume: number): void
/**
* 暂停状态
* @param name
*/
public abstract getPause(name: string): boolean
/**
* 从静态声音池中删除声音对象,如果一个声音再也不用了,建议先执行这个方法,再销毁
* @param {string} name 声音实例
*/
public abstract destory(name: string): void
}
\ No newline at end of file
/**
*Created by cuiliqiang on 2018/3/8
* 数据管理
*/
export abstract class ABDataManager {
/**
* 更新数据
* @param {number} name 接口名字
* @param result 接口返回数据
* @returns {any}
*/
public abstract updateData(name: number, result: any): any
}
\ No newline at end of file
import { IModuleData } from './../interface/IModuleData';
/**
* 模块管理器
*/
export abstract class ABModuleManager {
/**
* 初始化
* @param {ModuleData} modules
*/
public abstract init(modules: IModuleData[]): void
/**
* 按模块名获取模块数据
* @param {string} moduleName 模块名
* @returns {ModuleData}
*/
public abstract getModule(moduleName: string): IModuleData
/**
* 打开一个模块
* @param {string} moduleName 模块名
* @param args 携带参数
*/
public abstract openModule(moduleName: string, ...args): void
/**
* 访问模块内的公用方法
* @param {string} moduleName 模块名
* @param {string} funcName 方法名
*/
public abstract callModuleFunc(moduleName: string, funcName: string, ...args): void
}
\ No newline at end of file
import { INetData } from './../interface/INetData';
import { GTime } from "../util/GTime";
import { GConsole } from "../util/GConsole";
import { IData } from '../interface/IData';
export abstract class ABNetManager {
/**
* 接口底层错误
*/
public static ERROR = 'Error';
/**
* 调用接口对象池
*/
private callbackPool: any = {};
constructor() {
}
/**
* 发送请求
* @param net
*/
public send(net: INetData): void {
let gTime: string = '?_=' + GTime.getTimestamp();
let realUrl: string = net.uri;
if (realUrl.indexOf('?') != -1) {
gTime = '&_=' + GTime.getTimestamp();
}
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if (net.addUrl) {
realUrl += net.addUrl;
}
window['$'].ajax({
type: net.type,
// url: realUrl + gTime,
url: realUrl,
dataType: net.dataType,
data: net.param,
async: true,
success: (result) => {
this.onResponse(net, result);
//console.log(`[${net.uri}]${JSON.stringify(result)}`)
},
error: (message) => {
this.onError(net);
}
});
}
/**
* 消息响应
* @param net
*/
protected abstract onResponse(net: INetData, result: IData): void
/**
* 通讯底层错误
* @param net
* @param message
*/
protected abstract onError(net: INetData, message?: any): void
}
\ No newline at end of file
import { IModuleData } from "../interface/IModuleData";
/**
* 面板管理
*/
export abstract class ABPanelManager {
constructor() {
}
/**
* 显示面板
* @param {ModuleData} module 模块
* @param {any} data 数据
*/
public abstract show(module: IModuleData, data: any): void
/**
* 关闭面板
* @param moduleName
* @param dispose
*/
public abstract hide(moduleName: string, dispose?: boolean): void
/**
* 关闭所有面板
* @param {boolean} dispose
*/
public abstract hideAll(dispose?: boolean): void
/**
* 调用面板方法
* @param {ModuleName} moduleName
* @param {string} funcName
* @param args
*/
public abstract callFunc(moduleName: string, funcName: string, ...args): void
}
\ No newline at end of file
import { ResPriority } from './../enum/ResPriority';
import { IModuleData } from '../interface/IModuleData';
export abstract class ABResManager {
/**
* 添加资源到加载列表
* @param res
* @param priority
*/
public abstract addRes(res: any, priority: ResPriority): void
/**
* 加载资源
*/
public abstract loadRes(): void
/**
* 检测模块资源是否加载完成
* @param {ModuleData} module 模块数据
* @returns {boolean}
*/
public abstract checkRes(module: IModuleData): boolean
}
\ No newline at end of file
import { IModuleData } from "../interface/IModuleData";
/**
* 场景管理器
*/
export abstract class ABSceneManager {
constructor() {
}
/**
* 切换场景
* @param {ModuleData} module 模块数据
* @param {any} data 携带数据
*/
public abstract change(moduleData: IModuleData, data?: any): void
/**
* 调用场景方法
* @param {ModuleName} moduleName
* @param {string} funcName
* @param args 携带参数
*/
public abstract callFunc(moduleName: string, funcName: string, ...args): void
/**
* 当前场景名字
*/
public abstract get currSceneName(): string
}
\ No newline at end of file
import { LayoutType } from "../enum/LayoutType";
export abstract class ABStageManager {
/**
* 添加显示对象到指定容器
* @param {any} child 对象实例
* @param {any} container 容器实例
* @param {number} 指定层级 默认不指定层级
*/
public abstract addChild(child: any, container: any, index: number): void
/**
* 移除显示对象从父容器
* @param child 要移除的显示对象
*/
public abstract removeChild(child): void
/**
* 对齐方式
* @param display 显示对象
* @param mode 对齐方式 (left, right, top, bottom, horizontal, vertical)
* @param offset 偏移量
*/
public abstract align(display: any, layout: LayoutType, offset: number): void
}
\ No newline at end of file
export abstract class ABVideoManager {
/**
* 创建视频
* @param {string} name 名字
* @param {string} src 视频链接
* @param {number} width 视频宽,默认可以不填
* @param {number} height 视频高,默认可以不填
*/
public abstract createVideo(name: string, src: string, width?: number, height?: number): void
/**
* 获取当前最新的一个video对象
* @returns {any}
*/
public abstract getVideo(name: string): any
/**
* 开始播放媒体
* @method play
* @param {number} start 开始点 默认为0
* @param {number} loop 循环次数 默认为1
*/
public abstract play(start?: number, loop?: number): void
/**
* 暂停播放,或者恢复播放
* @method pause
* @param isPause 默认为true;是否要暂停,如果要暂停,则暂停;否则则播放
*/
public abstract pause(isPause?: boolean): void
/**
* 停止播放
*/
public abstract stop(): void
}
\ No newline at end of file
import { GFun } from './GFun';
import { GConsole } from './GConsole';
export class GCache {
private static gKey: string;
/**
* 初始化
* @param keys
*/
public static init(keys: string[]): void {
let i = 0;
const len: number = keys.length;
this.gKey = '';
for (i; i < len; i++) {
this.gKey += '_' + keys[i];
}
}
/**
* 写入缓存
* @param key
* @param value
* @param type type 缓存类型 localStorage永久缓存 sessionStorage浏览器生命周期结束前'
*/
public static writeCache(key: string, value: any, type = 'localStorage') {
if (!window[type]) {
GConsole.log(GFun.replace('webview不支持{0}', [type]));
return;
}
window[type].setItem(key + this.gKey, value);
}
/**
* 读取缓存
* @param key
* @param type type 缓存类型 localStorage永久缓存 sessionStorage浏览器生命周期结束前'
* @return
*/
public static readCache(key: string, type = 'localStorage'): string {
if (!window[type]) {
GConsole.log(GFun.replace('webview不支持{0}', [type]));
return;
}
return window[type].getItem(key + this.gKey);
}
/**
* 删除缓存
* @param key
* @param type 缓存类型 localStorage永久缓存 sessionStorage浏览器生命周期结束前
*/
public static removeCache(key: string, type = 'localStorage'): string {
if (!window[type]) {
GConsole.log(GFun.replace('webview不支持{0}', [type]));
return;
}
window[type].removeItem(key + this.gKey);
}
}
\ No newline at end of file
export class GConsole {
private static switch: boolean = window['debug'] || true;
/**
* 日志打印
* @param args
*/
public static log(...args): void {
if (!this.switch) {
return;
}
let i = 0;
const len: number = args.length;
for (i; i < len; i++) {
console.log(args[i]);
}
}
}
\ No newline at end of file
export class GDispatcher {
/**
* 事件回调池
*/
private static callbackPool: any = {};
/**
* 事件作用域池
*/
private static thisObjPool: any = {};
/**
*
* @param name 事件名
* @param callback 回调
* @param thisObj 作用域
*/
public static addEvent(name: string, callback, thisObj: any): void {
if (!this.callbackPool[name]) {
this.callbackPool[name] = [];
this.thisObjPool[name] = [];
}
const index: number = this.callbackPool[name].indexOf(callback);
if (index != -1) {
this.callbackPool[name][index] = callback;
this.thisObjPool[name][index] = thisObj;
} else {
this.callbackPool[name].push(callback);
this.thisObjPool[name].push(thisObj);
}
}
/**
*
* @param name 事件名
* @param callback 回调
* @param thisObj 作用域
*/
public static removeEvent(name: string, callback, thisObj?: any): void {
if (this.callbackPool[name]) {
const index: number = this.callbackPool[name].indexOf(callback);
if (index != -1) {
this.callbackPool[name].splice(index, 1);
this.thisObjPool[name].splice(index, 1);
}
}
}
/**
* 派发事件
* @param name 事件名
* @param args 任意参数
*/
public static dispatchEvent(name: string, ...args): void {
const callbacks: Function[] = this.callbackPool[name];
const thisObjs: any = this.thisObjPool[name];
if (callbacks) {
let i = 0;
const len: number = callbacks.length;
for (i; i < len; i++) {
callbacks[i].apply(thisObjs[i], args);
}
}
}
}
\ No newline at end of file
import { GMath } from './GMath';
import { GTime } from './GTime';
import { GConsole } from './GConsole';
export class GFun {
/**
* 加载 html Image
* @param url
* @param callback
*/
public static loadImage(url: string, callback: Function): any {
//取出跟url匹配的Image
const bitmapData: any = new Image();
bitmapData.onload = (e) => {
if (callback) {
callback(bitmapData);
}
};
bitmapData.src = url;
}
/**
* 替换字符串中元素
* @param str
* @param replaceList
*/
public static replace(str: string, replaceList: Array<string | number>) {
const len = replaceList.length;
for (let i = 0; i < len; i++) {
str = str.replace("{" + i + "}", replaceList[i].toString());
}
return str;
}
/**
* 是否在app内运行
* @param strs 匹配字符串
*/
public static checkInApp(strs: string[]): boolean {
const ua = navigator.userAgent.toLocaleLowerCase();
let i: number;
const len: number = strs.length;
for (i = 0; i < len; i++) {
if (ua.indexOf(strs[i]) != -1) {
return true;
}
}
return false;
}
/**
* 判断操作系统
* @returns {Array|{index: number, input: string}}
*/
public static get isIOS(): boolean {
return navigator.userAgent.match(/iphone|ipod|ipad/gi) != null;
}
/**
* 获取url参数
*/
public static getQueryString(name): any {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
const r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
}
}
const check_webp_feature = (callback) => {
const _support_webp_ = localStorage.getItem('_support_webp_');
if (_support_webp_ !== null) {
return callback(_support_webp_ === '1')
}
const img = new Image();
img.onload = function () {
const result = (img.width > 0) && (img.height > 0);
callback(result);
localStorage.setItem('_support_webp_', result ? '1' : '0')
};
img.onerror = function () {
callback(false);
localStorage.setItem('_support_webp_', '0')
};
img.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
}
export const getImgURL = (url: string, cb) => {
check_webp_feature((isSupport) => {
if (isSupport) url += '?x-oss-process=image/format,webp';
cb(url)
})
}
\ No newline at end of file
export class GLang {
public static lang_001 = "pre资源加载完成";
public static lang_002 = "nomarl资源加载完成";
public static lang_003 = "delay资源加载完成";
}
\ No newline at end of file
export class GMath {
/**
* 向下取整
* @param n
* @returns {number}
*/
public static int(n: any): number {
return n >> 0;
}
/**
* 给数组随机排序
* @param arr
*/
public static randomArr(arr: any[]): any[] {
const len = arr.length;
for (let i = 0; i < len; i++) {
const n = this.random(0, arr.length, true);
const temp = arr[n];
arr[n] = arr[i];
arr[i] = temp;
}
return arr;
}
/**
* 范围随机数
* @param n1 范围起始
* @param n2 范围结束
* @param int 结果是否返回整数
* @return {*}
*/
public static random(n1: number, n2: number, int: boolean): number {
let n: number;
let min: number;
let max: number;
if ((typeof n1) != 'undefined' && (typeof n2) != 'undefined') {
min = Math.min(n1, n2);
max = Math.max(n1, n2);
n = Math.random() * (max - min) + min;
} else {
n = Math.random();
}
if (int) {
n = this.int(n);
}
return n;
}
}
\ No newline at end of file
/**
* 对象池
*/
export class GPool {
private static pool: any = {};
private static maxCount = {};
/**
* 根据类型设置缓存最大个数
* @param className
* @param count
*/
public static setMaxCountByType(className: any, count): void {
this.maxCount[className] = count;
}
/**
* 取出
* @param className 资源名
* @param 类名
*/
public static takeOut(className: string, classObj?: any, isCreate?: boolean): any {
if (!className || className == '') {
return;
}
let obj: any;
if (this.pool[className] && this.pool[className].length) {
obj = this.pool[className].shift();
} else if (isCreate) {
if (!classObj) {
classObj = eval(className);
}
obj = new classObj();
}
return obj;
}
/**
* 回收
* @param className 资源Class
* @param obj 资源
*/
public static recover(className: string, obj: any): void {
if (!obj || !className) {
return;
}
if (!this.pool[className]) {
this.pool[className] = [];
}
if (!this.maxCount[className]) {
this.maxCount[className] = 100;
}
if (this.pool[className].length > this.maxCount[className]) {
return;
}
this.pool[className].push(obj);
if (obj['dispose']) {
obj.dispose();
}
}
}
\ No newline at end of file
import { TimeFormat } from "../enum/TimeFormat";
export class GTime {
/**
* 获取当前时间戳
* @returns {number}
*/
public static getTimestamp(): number {
return new Date().getTime();
}
/**
* 传入秒数返回带格式的时间
* @param time 单位秒
* @param type 枚举类型CountDownType
* @param dibit 是否双位
*/
public static formatTime(time: number, type: string = TimeFormat.HMS, dibit = false, suffixs = ['d', 'h', 'm', 's']): string {
let countdown = this.getCountDown(time, type, dibit);
countdown = countdown.map((val, index) => `${val < 10 ? '0' + val : val}${suffixs[index]}`);
return countdown.join('');
}
/**
* 倒计时
* @param time 单位秒
* @param type 枚举类型CountDownType
* @param dibit 是否双位
*/
public static getCountDown(time: number, type: string = TimeFormat.HMS, dibit = false): any[] {
let result: any[] = [];
if (type.indexOf('s') !== -1) {
result.push(time % 60);
}
if (type.indexOf('m') !== -1) {
result.unshift(Math.floor((time % 3600) / 60));
}
if (type.indexOf('h') >= 0) {
if (type == TimeFormat.HMS) {
result.unshift(Math.floor(time / 3600));
}
else {
result.unshift(Math.floor((time % 86400) / 3600));
}
}
if (type.indexOf('d') >= 0) {
result.unshift(Math.floor(time / 86400));
}
if (dibit)
result = result.map((ele) => {
return ele < 10 ? `0${ele}` : ele;
})
return result;
}
}
\ No newline at end of file
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"noImplicitAny": false,
"noEmitOnError": true,
"declarationDir": "./types",
"declaration": true,
"outDir": "./dist"
},
"exclude": [
"node_modules",
"dist",
"types"
]
}
\ No newline at end of file
exports.__esModule = true;
exports.rules = {
"only-arrow-functions": true,
"no-namespace": true,
"no-var-keyword": true,
"prefer-const": true,
"no-conditional-assignment": true,
"prefer-for-of": true,
"no-inferrable-types": true,
"cyclomatic-complexity": [true, 20],
"max-line-length": [true, 150],
"max-file-line-count": [true, 500],
"max-classes-per-file": [true, 6],
"adjacent-overload-signatures": true,
"member-access":true,
"no-non-null-assertion": true,
"no-consecutive-blank-lines": true,
"no-unused-expression": [true, "allow-fast-null-checks"],
"no-duplicate-super": true,
"no-import-side-effect": true
};
\ No newline at end of file
{
"defaultSeverity": "error",
"extends": [
// "tslint:recommended"
"./tslint-config"
],
"jsRules": {},
"rules": {},
"rulesDirectory": []
}
\ No newline at end of file
import { IModuleData } from "../interface/IModuleData";
import { IDestroy } from "../interface/IDestroy";
/**
*Created by cuiliqiang on 2018/3/1
* 组件基类
*/
export declare abstract class ABModule implements IDestroy {
/**
* 模块数据
*/
private _data;
/**
* 视图层
*/
private _view;
constructor(data: IModuleData);
/**
* 初始化模型
*/
protected abstract initModel(): void;
/**
* 初始化UI
*/
protected abstract initUI(): void;
/**
* 显示
*/
protected abstract show(): void;
/**
* 隐藏
*/
protected abstract hide(): void;
/**
* 添加事件
*/
protected abstract addEvent(): void;
/**
* 移除事件
*/
protected abstract removeEvent(): void;
/**
* 更新页面
* @param args
*/
abstract updateData(...args: any[]): void;
/**
* 播放进场动画
* @param callback 回调函数
*/
abstract playShowAnimation(callback?: Function): void;
/**
* 播放退场动画
* @param callback 回调函数
*/
abstract playHideAnimation(callback?: Function): void;
/**
* 销毁
*/
abstract dispose(): void;
/**
* 模块数据
* @returns {IModuleData}
*/
readonly data: IModuleData;
/**
* 视图
* @returns {any}
*/
protected readonly view: any;
}
/**
*Created by cuiliqiang on 2018/3/13
* 布局枚举
*/
export declare enum LayoutType {
TOP = 0,
BOTTOM = 1,
LEFT = 2,
RIGHT = 3,
HORIZONTAL = 4,
VERTICAL = 5
}
/**
*Created by cuiliqiang on 2018/3/16
* 模块类型
*/
export declare enum ModuleType {
SCENE = 0,
PANEL = 1
}
/**
*Created by cuiliqiang on 2018/3/15
* 资源加载优先级
*/
export declare enum ResPriority {
PRE = 0,
NOMARL = 1,
DELAY = 2
}
/**
*Created by cuiliqiang on 2018/3/26
* 时间格式
*/
export declare enum TimeFormat {
HMS = "hms",
DHMS = "dhms"
}
import { GLang } from './util/GLang';
import { INetData } from './interface/INetData';
import { GTime } from './util/GTime';
import { GPool } from './util/GPool';
import { GMath } from './util/GMath';
import { GFun, getImgURL } from './util/GFun';
import { GDispatcher } from './util/GDispatcher';
import { GConsole } from './util/GConsole';
import { GCache } from './util/GCache';
import { ABPanelManager } from './manager/ABPanelManager';
import { IModuleData } from './interface/IModuleData';
import { IDestroy } from './interface/IDestroy';
import { TimeFormat } from './enum/TimeFormat';
import { ResPriority } from './enum/ResPriority';
import { ModuleType } from './enum/ModuleType';
import { LayoutType } from './enum/LayoutType';
import { ABModule } from "./component/ABModule";
import { IData } from './interface/IData';
import { ABAnimationManager } from './manager/ABAnimationManager';
import { ABAudioManager } from './manager/ABAudioManager';
import { ABResManager } from './manager/ABResManager';
import { ABSceneManager } from './manager/ABSceneManager';
import { ABStageManager } from './manager/ABStageManager';
import { ABDataManager } from './manager/ABDataManager';
import { ABModuleManager } from './manager/ABModuleManager';
import { ABNetManager } from './manager/ABNetManager';
import { ABVideoManager } from './manager/ABVideoManager';
export { ABModule, LayoutType, ModuleType, ResPriority, TimeFormat, IData, IDestroy, INetData, IModuleData, ABAnimationManager, ABAudioManager, ABDataManager, ABModuleManager, ABNetManager, ABPanelManager, ABResManager, ABSceneManager, ABStageManager, ABVideoManager, GCache, GConsole, GDispatcher, GFun, GMath, GPool, GTime, GLang, getImgURL };
/**
*Created by cuiliqiang on 2018/3/8
*/
export interface IData {
update(data: any): void;
}
/**
*Created by cuiliqiang on 2018/2/28
* 销毁
*/
export interface IDestroy {
dispose(): void;
}
/**
*Created by cuiliqiang on 2018/3/13
* 模块数据
*/
import { ResPriority } from "../enum/ResPriority";
import { ModuleType } from "../enum/ModuleType";
export interface IModuleData {
/**
* 模块名字
*/
moduleName: string;
/**
* 模块类
*/
moduleClass: any;
/**
* 视图类
*/
viewClass: any;
/**
* 资源
*/
res: string;
/**
* 资源加载优先级
*/
resPriority: ResPriority;
/**
* 类型 1 场景, 2面板
*/
type: ModuleType;
/**
* 显示层级
*/
layerIndex: number;
/**
* 显示遮罩背景
*/
showBg: boolean;
/**
* 是否可以事件穿透
*/
eventPenetrate: boolean;
/**
* 进场动画
*/
showAnimation?: Function;
/**
* 退场动画
*/
hideAnimation?: Function;
/**
* UI配置
*/
uiCfg?: any;
}
export interface INetData {
name: any;
uri: string;
type: string;
dataType: string;
param: any;
callback: Function;
pollingCount?: number;
pollingCheck?: Function;
addUrl?: string;
hideMsg?: boolean;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment