light-h5-core-lib 1.0.2 → 1.2.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/lib/Main.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var BaseSingleton_1 = require("./common/base/BaseSingleton");
4
- var BitUtil_1 = require("./common/util/BitUtil");
5
- var DateUtil_1 = require("./common/util/DateUtil");
6
- var FloatDigitUtil_1 = require("./common/util/FloatDigitUtil");
7
- var RandomNumUtil_1 = require("./common/util/RandomNumUtil");
8
- var StringUtil_1 = require("./common/util/StringUtil");
9
- var PoolObj_1 = require("./pool/PoolObj");
3
+ var BaseSingleton_1 = require("./BaseSingleton");
4
+ var BitUtil_1 = require("./BitUtil");
5
+ var DateUtil_1 = require("./DateUtil");
6
+ var FloatDigitUtil_1 = require("./FloatDigitUtil");
7
+ var RandomNumUtil_1 = require("./RandomNumUtil");
8
+ var StringUtil_1 = require("./StringUtil");
9
+ var PoolObj_1 = require("./PoolObj");
10
10
  BaseSingleton_1.BaseSingleton;
11
11
  PoolObj_1.PoolObj;
12
12
  StringUtil_1.StringUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "light-h5-core-lib",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "types": "./type/index.d.ts",
5
5
  "description": "",
6
6
  "main": "./lib/Main.js",
package/type/index.d.ts CHANGED
@@ -1,147 +1,136 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  declare class BaseSingleton<T> {
4
- private static _instance;
5
- static getInstance<T>(c: { new (): T }): T;
4
+ private static _instance;
5
+ static getInstance<T>(c: {
6
+ new (): T;
7
+ }): T;
6
8
  }
7
9
  declare class BitUtil {
8
- /**
9
- * 读取uint类型某位的值, bit从1开始
10
- */
11
- static getBit(value: number, bit: number): number;
12
- /**
13
- * 设置value 第bit(从1开始)位的值为v(0|1)
14
- * 谨记bit<32
15
- */
16
- static setBit(value: number, bit: number, v: 0 | 1): number;
17
- /**获取1的个数 */
18
- static get1num(value: number): number;
10
+ /**
11
+ * 读取uint类型某位的值, bit从1开始
12
+ */
13
+ static getBit(value: number, bit: number): number;
14
+ /**
15
+ * 设置value 第bit(从1开始)位的值为v(0|1)
16
+ * 谨记bit<32
17
+ */
18
+ static setBit(value: number, bit: number, v: 0 | 1): number;
19
+ /**获取1的个数 */
20
+ static get1num(value: number): number;
19
21
  }
20
22
  declare class DateUtil {
21
- /**
22
- * 获取指定时间的时间戳 (单位:ms)
23
- * @param date 如: "2020-3-14 11:30:30"
24
- */
25
- static getTargetTimeStamp(date: string): number;
26
- /**
27
- * 获取指定时间的时间秒 (单位:s)
28
- * @param date 如: "2020-3-14 11:30:30"
29
- */
30
- static getTargetSeconds(date: string): number;
31
- /**
32
- * 格式化时间(时,分,秒)
33
- * @param s 秒
34
- * @param separator 分隔符(default: ":")
35
- * @param isSingle0 是否补0(default:true)
36
- * @param isDiscardH 小时数为0时,是否舍弃显示变成分,秒(default:false)
37
- */
38
- static format_HMS(
39
- s: number,
40
- separator?: string,
41
- isSingle0?: boolean,
42
- isDiscardH?: boolean
43
- ): string;
44
- /**
45
- * 格式化时间(分,秒)
46
- * @param s 秒
47
- * @param separator 分隔符(default: ":")
48
- * @param isSingle0 是否补0(default:true)
49
- */
50
- static format_MS(s: number, separator?: string, isSingle0?: boolean): string;
51
- /**
52
- * 获取下一天的时间(凌晨)秒 存在1ms误差可以忽略不计
53
- * @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
54
- * @return 下一天的时间Second
55
- * */
56
- static getNextDayTimeStamp(nowSecond: number): number;
57
- /**
58
- * 获取今日指定的时间秒, 例如今日20:00
59
- * @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
60
- * @param hour 指定的小时数 0~23
61
- * @param minute 指定的分钟数 0~59
62
- * @param second 指定的秒数 0~59
63
- * @param millisecond 指定的毫秒数 0~999
64
- */
65
- static getTodayAppointTimeStamp(
66
- nowSecond: number,
67
- hour: number,
68
- minute?: number,
69
- second?: number,
70
- millisecond?: number
71
- ): number;
23
+ /**
24
+ * 获取指定时间的时间戳 (单位:ms)
25
+ * @param date 如: "2020-3-14 11:30:30"
26
+ */
27
+ static getTargetTimeStamp(date: string): number;
28
+ /**
29
+ * 获取指定时间的时间秒 (单位:s)
30
+ * @param date 如: "2020-3-14 11:30:30"
31
+ */
32
+ static getTargetSeconds(date: string): number;
33
+ /**
34
+ * 格式化时间(时,分,秒)
35
+ * @param s 秒
36
+ * @param separator 分隔符(default: ":")
37
+ * @param isSingle0 是否补0(default:true)
38
+ * @param isDiscardH 小时数为0时,是否舍弃显示变成分,秒(default:false)
39
+ */
40
+ static format_HMS(s: number, separator?: string, isSingle0?: boolean, isDiscardH?: boolean): string;
41
+ /**
42
+ * 格式化时间(分,秒)
43
+ * @param s 秒
44
+ * @param separator 分隔符(default: ":")
45
+ * @param isSingle0 是否补0(default:true)
46
+ */
47
+ static format_MS(s: number, separator?: string, isSingle0?: boolean): string;
48
+ /**
49
+ * 获取下一天的时间(凌晨)秒 存在1ms误差可以忽略不计
50
+ * @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
51
+ * @return 下一天的时间Second
52
+ * */
53
+ static getNextDayTimeStamp(nowSecond: number): number;
54
+ /**
55
+ * 获取今日指定的时间秒, 例如今日20:00
56
+ * @param nowSecond 现在的时间秒 ( 服务器的时间(一般))
57
+ * @param hour 指定的小时数 0~23
58
+ * @param minute 指定的分钟数 0~59
59
+ * @param second 指定的秒数 0~59
60
+ * @param millisecond 指定的毫秒数 0~999
61
+ */
62
+ static getTodayAppointTimeStamp(nowSecond: number, hour: number, minute?: number, second?: number, millisecond?: number): number;
72
63
  }
73
64
  declare class FloatDigitUtil {
74
- /**
75
- * 确定小数的精度<b style="color:red">2个小数相加会有精度错误</b>
76
- * @param fNum 小数
77
- * @param digit 精度
78
- */
79
- static formatFloat(fNum: number, digit: number): number;
65
+ /**
66
+ * 确定小数的精度<b style="color:red">2个小数相加会有精度错误</b>
67
+ * @param fNum 小数
68
+ * @param digit 精度
69
+ */
70
+ static formatFloat(fNum: number, digit: number): number;
80
71
  }
81
72
  declare class RandomNumUtil {
82
- /**
83
- * 获取一定方位的随机整数
84
- *
85
- * <b>( min ≤ r ≤ max )</b>
86
- *
87
- * @param min 最小数
88
- * @param max 最大数
89
- * @param isInt 是否返回整数
90
- */
91
- static randomNumBoth(min: number, max: number, isInt?: boolean): number;
73
+ /**
74
+ * 获取一定方位的随机整数
75
+ *
76
+ * <b>( min ≤ r ≤ max )</b>
77
+ *
78
+ * @param min 最小数
79
+ * @param max 最大数
80
+ * @param isInt 是否返回整数
81
+ */
82
+ static randomNumBoth(min: number, max: number, isInt?: boolean): number;
92
83
  }
93
84
  declare class StringUtil {
94
- /**
95
- * 字符串的格式化 , 使用 {index = 0}的模式
96
- * @param str 源字符串
97
- * @param args 填充参数
98
- */
99
- static format(str: string, ...args: Array<any>): string;
100
- private static code2utf8;
101
- /**
102
- * 将字符串转化成UTF8的Buffer
103
- * @param str 字符串
104
- */
105
- static string2UTF8Buffer(str: string): ArrayBuffer;
106
- static buffer2UTF8String: (buffer: ArrayBuffer) => string;
85
+ /**
86
+ * 字符串的格式化 , 使用 {index = 0}的模式
87
+ * @param str 源字符串
88
+ * @param args 填充参数
89
+ */
90
+ static format(str: string, ...args: Array<any>): string;
91
+ private static code2utf8;
92
+ /**
93
+ * 将字符串转化成UTF8的Buffer
94
+ * @param str 字符串
95
+ */
96
+ static string2UTF8Buffer(str: string): ArrayBuffer;
97
+ static buffer2UTF8String: (buffer: ArrayBuffer) => string;
107
98
  }
108
99
  export interface IDestroy {
109
- destroy(): void;
100
+ destroy(): void;
110
101
  }
111
102
  export interface IClear extends IDestroy {
112
- clear(): void;
103
+ clear(): void;
113
104
  }
114
105
  declare class PoolObj<T> implements IClear {
115
- private _pool;
116
- private _cup;
117
- /**
118
- * @param cup 容量
119
- */
120
- constructor(cup?: number);
121
- put(obj: T): boolean;
122
- one(): T;
123
- /**
124
- * 获取容量(容积)
125
- */
126
- get cup(): number;
127
- /**
128
- * 获取当前数量(已经保存的元素个数)
129
- */
130
- get size(): number;
131
- /**
132
- * 清理对象池
133
- */
134
- clear(): void;
135
- destroy(isCleared?: boolean): void;
106
+ private _pool;
107
+ private _cup;
108
+ /**
109
+ * @param cup 容量
110
+ */
111
+ constructor(cup?: number);
112
+ put(obj: T): boolean;
113
+ one(): T;
114
+ /**
115
+ * 获取容量(容积)
116
+ */
117
+ get cup(): number;
118
+ /**
119
+ * 获取当前数量(已经保存的元素个数)
120
+ */
121
+ get size(): number;
122
+ /**
123
+ * 清理对象池
124
+ */
125
+ clear(): void;
126
+ destroy(isCleared?: boolean): void;
136
127
  }
137
- export declare const core: {
138
- BaseSingleton: typeof BaseSingleton;
139
- PoolObj: typeof PoolObj;
140
- StringUtil: typeof StringUtil;
141
- BitUtil: typeof BitUtil;
142
- DateUtil: typeof DateUtil;
143
- FloatDigitUtil: typeof FloatDigitUtil;
144
- RandomNumUtil: typeof RandomNumUtil;
145
- };
128
+ export declare const LightBaseSingleton: typeof BaseSingleton;
129
+ export declare const LightBitUtil: typeof BitUtil;
130
+ export declare const LightDateUtil: typeof DateUtil;
131
+ export declare const LightFloatDigitUtil: typeof FloatDigitUtil;
132
+ export declare const LightRandomNumUtil: typeof RandomNumUtil;
133
+ export declare const LightStringUtil: typeof StringUtil;
134
+ export declare const LightPoolObj: typeof PoolObj;
146
135
 
147
136
  export {};
File without changes
File without changes
File without changes
File without changes
File without changes