light-h5-core-lib 2.9.1 → 2.10.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.
package/common/util/DateUtil.js
CHANGED
|
@@ -23,7 +23,7 @@ var DateUtil = /** @class */ (function () {
|
|
|
23
23
|
return Math.floor(DateUtil.getTargetTimeStamp(date) / 1000);
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* 格式化时间(时,分,秒)
|
|
26
|
+
* 格式化时间(时,分,秒)<b style="color:red">使用 separator分割</b>
|
|
27
27
|
* @param s 秒
|
|
28
28
|
* @param separator 分隔符(default: ":")
|
|
29
29
|
* @param isSingle0 是否补0(default:true)
|
|
@@ -63,7 +63,7 @@ var DateUtil = /** @class */ (function () {
|
|
|
63
63
|
return result;
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
|
-
* 获取下一天的时间(凌晨)秒 存在1ms
|
|
66
|
+
* 获取下一天的时间(凌晨)秒 存在1ms误差可以忽略不计<b style="color:red">当天时间24:00</b>
|
|
67
67
|
* @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
|
|
68
68
|
* @return 下一天的时间Second
|
|
69
69
|
* */
|
|
@@ -71,7 +71,7 @@ var DateUtil = /** @class */ (function () {
|
|
|
71
71
|
return DateUtil.getTodayAppointTimeStamp(nowSecond, 23, 59, 59, 999);
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* 获取今日指定的时间(秒), 例如今日20:00
|
|
75
75
|
* @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
|
|
76
76
|
* @param hour 指定的小时数 0~23
|
|
77
77
|
* @param minute 指定的分钟数 0~59
|
package/package.json
CHANGED
package/pool/PoolObj.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.PoolObj = void 0;
|
|
|
7
7
|
*/
|
|
8
8
|
var PoolObj = /** @class */ (function () {
|
|
9
9
|
/**
|
|
10
|
-
* @param cap 容量(容积)
|
|
11
|
-
* @param initCreateNum
|
|
10
|
+
* @param cap 容量(容积) <b style="color:red">小于等于0:无限容量,慎用</b>
|
|
11
|
+
* @param initCreateNum 初始化创建数量 <b style="color:red">(createCallback != null 有效)</b>
|
|
12
12
|
* @param createCallback Item创建函数
|
|
13
13
|
* @param clearCallback Item清理函数
|
|
14
14
|
* @param destroyCallback Item销毁函数
|
|
@@ -19,12 +19,12 @@ var PoolObj = /** @class */ (function () {
|
|
|
19
19
|
if (createCallback === void 0) { createCallback = null; }
|
|
20
20
|
if (clearCallback === void 0) { clearCallback = null; }
|
|
21
21
|
if (destroyCallback === void 0) { destroyCallback = null; }
|
|
22
|
-
this._cap = cap;
|
|
22
|
+
this._cap = cap == null ? 5 : cap;
|
|
23
23
|
this._createCallback = createCallback;
|
|
24
24
|
this._clearCallback = clearCallback;
|
|
25
25
|
this._destroyCallback = destroyCallback;
|
|
26
26
|
this._pool = [];
|
|
27
|
-
this.initCreate(initCreateNum);
|
|
27
|
+
this.initCreate(initCreateNum == null ? 0 : initCreateNum);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* 初始化一些数量的item
|
|
@@ -34,7 +34,7 @@ var PoolObj = /** @class */ (function () {
|
|
|
34
34
|
return;
|
|
35
35
|
if (!this._createCallback)
|
|
36
36
|
return;
|
|
37
|
-
var maxNum = Math.min(this._cap, initCreateNum);
|
|
37
|
+
var maxNum = this._cap > 0 ? Math.min(this._cap, initCreateNum) : initCreateNum;
|
|
38
38
|
for (var i = 0; i < maxNum; i++) {
|
|
39
39
|
this._pool.push(this._createCallback());
|
|
40
40
|
}
|
|
@@ -46,7 +46,7 @@ var PoolObj = /** @class */ (function () {
|
|
|
46
46
|
PoolObj.prototype.put = function (obj) {
|
|
47
47
|
if (!obj)
|
|
48
48
|
return false;
|
|
49
|
-
if (this._pool.length >= this._cap) {
|
|
49
|
+
if (this._cap > 0 && this._pool.length >= this._cap) {
|
|
50
50
|
this._destroyCallback && this._destroyCallback(obj);
|
|
51
51
|
return false;
|
|
52
52
|
}
|
package/type/index.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export declare class PoolObj<T> implements IClear {
|
|
|
17
17
|
private _clearCallback;
|
|
18
18
|
private _destroyCallback;
|
|
19
19
|
/**
|
|
20
|
-
* @param cap 容量(容积)
|
|
21
|
-
* @param initCreateNum
|
|
20
|
+
* @param cap 容量(容积) <b style="color:red">小于等于0:无限容量,慎用</b>
|
|
21
|
+
* @param initCreateNum 初始化创建数量 <b style="color:red">(createCallback != null 有效)</b>
|
|
22
22
|
* @param createCallback Item创建函数
|
|
23
23
|
* @param clearCallback Item清理函数
|
|
24
24
|
* @param destroyCallback Item销毁函数
|
|
@@ -113,7 +113,7 @@ export declare class DateUtil {
|
|
|
113
113
|
*/
|
|
114
114
|
static getTargetSeconds(date: string): number;
|
|
115
115
|
/**
|
|
116
|
-
* 格式化时间(时,分,秒)
|
|
116
|
+
* 格式化时间(时,分,秒)<b style="color:red">使用 separator分割</b>
|
|
117
117
|
* @param s 秒
|
|
118
118
|
* @param separator 分隔符(default: ":")
|
|
119
119
|
* @param isSingle0 是否补0(default:true)
|
|
@@ -128,13 +128,13 @@ export declare class DateUtil {
|
|
|
128
128
|
*/
|
|
129
129
|
static format_MS(s: number, separator?: string, isSingle0?: boolean): string;
|
|
130
130
|
/**
|
|
131
|
-
* 获取下一天的时间(凌晨)秒 存在1ms
|
|
131
|
+
* 获取下一天的时间(凌晨)秒 存在1ms误差可以忽略不计<b style="color:red">当天时间24:00</b>
|
|
132
132
|
* @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
|
|
133
133
|
* @return 下一天的时间Second
|
|
134
134
|
* */
|
|
135
135
|
static getNextDayTimeStamp(nowSecond: number): number;
|
|
136
136
|
/**
|
|
137
|
-
*
|
|
137
|
+
* 获取今日指定的时间(秒), 例如今日20:00
|
|
138
138
|
* @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
|
|
139
139
|
* @param hour 指定的小时数 0~23
|
|
140
140
|
* @param minute 指定的分钟数 0~59
|
|
@@ -261,7 +261,7 @@ export declare class UniqueIDUtil {
|
|
|
261
261
|
static getCompositeKey(key: string | number, uniqueId: string): string;
|
|
262
262
|
}
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
264
|
+
* 贝塞尔曲线运动工具<b style="color:red">支持多点</b>
|
|
265
265
|
* @author Aonaufly
|
|
266
266
|
*/
|
|
267
267
|
export declare class BeizerUtil {
|