1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| /*
| * @Company: hugeInfo
| * @Author: ldh
| * @Date: 2022-03-22 14:42:30
| * @LastEditTime: 2022-11-07 16:07:00
| * @LastEditors: ldh
| * @Version: 1.0.0
| * @Description: 计时器管理
| */
| class timerHandle {
| constructor() {
| this.timer = {};
| }
|
| setInterval(key, func, interval, data) {
| this.timer[key] = setInterval(func, interval, data);
| }
|
| clearInterval(key) {
| clearInterval(this.timer[key]);
| }
|
| setTimeout(key, func, interval) {
| this.timer[key] = setTimeout(func, interval);
| }
|
| clearTimeOut(key) {
| clearTimeout(this.timer[key]);
| }
| }
|
| export default new timerHandle();
|
|