UNPKG

laya-coreui-es

Version:

laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改

30 lines (29 loc) 983 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PoolCache = void 0; const CacheManger_1 = require("./CacheManger"); const Utils_1 = require("./Utils"); const Pool_1 = require("./Pool"); class PoolCache { constructor() { this.maxCount = 1000; } getCacheList() { return Pool_1.Pool.getPoolBySign(this.sign); } tryDispose(force) { var list; list = Pool_1.Pool.getPoolBySign(this.sign); if (list.length > this.maxCount) { list.splice(this.maxCount, list.length - this.maxCount); } } static addPoolCacheManager(sign, maxCount = 100) { var cache; cache = new PoolCache(); cache.sign = sign; cache.maxCount = maxCount; CacheManger_1.CacheManger.regCacheByFunction(Utils_1.Utils.bind(cache.tryDispose, cache), Utils_1.Utils.bind(cache.getCacheList, cache)); } } exports.PoolCache = PoolCache;