light-h5-core-lib 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,12 @@ import { FloatDigitUtil } from "./common/util/FloatDigitUtil";
6
6
  import { RandomNumUtil } from "./common/util/RandomNumUtil";
7
7
  import { StringUtil } from "./common/util/StringUtil";
8
8
  import { UniqueIDUtil } from "./common/util/UniqueIDUtil";
9
+ var LightCore = /** @class */ (function () {
10
+ function LightCore() {
11
+ }
12
+ return LightCore;
13
+ }());
14
+ export { LightCore };
9
15
  export { PoolObj };
10
16
  export { BaseSingleton };
11
17
  export { BitUtil };
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "light-h5-core-lib",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "light core lib",
5
- "main": "./Main.js",
5
+ "main": "./LightCore.js",
6
6
  "types": "./type/index.d.ts",
7
+ "files": [
8
+ "./type/index.d.ts",
9
+ "./LightCore.js",
10
+ "./common/**/*.js",
11
+ "./pool/pool.js"
12
+ ],
7
13
  "scripts": {
8
14
  "test": "echo \"Error: no test specified\" && exit 1"
9
15
  },
package/type/index.d.ts CHANGED
@@ -159,5 +159,7 @@ export declare class UniqueIDUtil {
159
159
  /**生成复合的Key值*/
160
160
  static getCompositeKey(key: string | number, uniqueId: string): string;
161
161
  }
162
+ export declare class LightCore {
163
+ }
162
164
 
163
165
  export {};
package/pool/PoolObj.js DELETED
@@ -1,76 +0,0 @@
1
- /**
2
- * 对象池(泛型)
3
- * @author aonaufly
4
- */
5
- var PoolObj = /** @class */ (function () {
6
- /**
7
- * @param cup 容量
8
- */
9
- function PoolObj(cup) {
10
- if (cup === void 0) { cup = 5; }
11
- this._cup = cup;
12
- this._pool = [];
13
- }
14
- PoolObj.prototype.put = function (obj) {
15
- if (!obj || this._pool.length >= this._cup)
16
- return false;
17
- this._pool.push(obj);
18
- return true;
19
- };
20
- PoolObj.prototype.one = function () {
21
- if (this._pool.length == 0)
22
- return null;
23
- return this._pool.shift();
24
- };
25
- Object.defineProperty(PoolObj.prototype, "cup", {
26
- /**
27
- * 获取容量(容积)
28
- */
29
- get: function () {
30
- return this._cup;
31
- },
32
- enumerable: false,
33
- configurable: true
34
- });
35
- Object.defineProperty(PoolObj.prototype, "size", {
36
- /**
37
- * 获取当前数量(已经保存的元素个数)
38
- */
39
- get: function () {
40
- if (!this._pool)
41
- return 0;
42
- return this._pool.length;
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- /**
48
- * 清理对象池
49
- */
50
- PoolObj.prototype.clear = function () {
51
- if (!this._pool)
52
- return;
53
- if (this._pool.length == 0)
54
- return;
55
- var obj;
56
- for (var i = 0, j = this._pool.length; i < j; i++) {
57
- obj = this._pool[i];
58
- if (obj.destroy) {
59
- obj.destroy();
60
- }
61
- else if (obj.onDestroy) {
62
- obj.onDestroy();
63
- }
64
- obj = null;
65
- }
66
- this._pool.length = 0;
67
- };
68
- PoolObj.prototype.destroy = function (isCleared) {
69
- if (!isCleared) {
70
- this.clear();
71
- }
72
- this._pool && (this._pool = null);
73
- };
74
- return PoolObj;
75
- }());
76
- export { PoolObj };