@cc-component/cc-core 1.8.4 → 1.8.6
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.
|
@@ -11,6 +11,7 @@ export class TimeManager {
|
|
|
11
11
|
private countdowns: Map<string, CountdownInfo> = new Map();
|
|
12
12
|
timers = new Map();
|
|
13
13
|
|
|
14
|
+
timersKeys = new Map();
|
|
14
15
|
/** 服务器时间 */
|
|
15
16
|
private date_s: Date = new Date();
|
|
16
17
|
/** 服务器初始时间 */
|
|
@@ -214,19 +215,19 @@ export class TimeManager {
|
|
|
214
215
|
|
|
215
216
|
//#region 暂停和恢复计时器
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
setTimeout(callback, delay) {
|
|
218
|
+
setTimeout(key: string, callback, delay) {
|
|
220
219
|
const timerId = window.setTimeout(() => {
|
|
221
220
|
callback();
|
|
222
221
|
this.timers.delete(timerId); // 定时器执行后,从Map中删除
|
|
223
222
|
}, delay);
|
|
224
223
|
|
|
225
224
|
this.timers.set(timerId, () => window.clearTimeout(timerId));
|
|
225
|
+
this.timersKeys.set(key, timerId)
|
|
226
226
|
return timerId;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
clearTimeout(
|
|
229
|
+
clearTimeout(key: string) {
|
|
230
|
+
const timerId = this.timersKeys.get(key)
|
|
230
231
|
if (this.timers.has(timerId)) {
|
|
231
232
|
this.timers.get(timerId)();
|
|
232
233
|
this.timers.delete(timerId); // 从Map中删除定时器
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* @LastEditTime: 2022-09-09 18:10:50
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { HttpType, IExtData, IHttpConfig
|
|
8
|
+
import { HttpType, IExtData, IHttpConfig } from "../../../config/CommonEnum";
|
|
9
|
+
import { LayerType } from "../../../config/LayerType";
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
/** HTTP请求返回值 */
|