File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change
1
+ import debounce from 'debounce'
1
2
/**
2
3
* @description 获取文件类型
3
4
* @param url 文件地址
@@ -51,22 +52,6 @@ export function randomString(length: number): string {
51
52
return result
52
53
}
53
54
54
- /**
55
- * @description 防抖函数
56
- * @param func 函数
57
- * @param delay 延迟时间
58
- * @returns { Function } Function:防抖函数
59
- */
60
- export function debounce ( func : Function , delay : number ) : Function {
61
- let timer : NodeJS . Timeout
62
- return function ( this : any , ...args : any [ ] ) {
63
- clearTimeout ( timer )
64
- timer = setTimeout ( ( ) => {
65
- func . apply ( this , args )
66
- } , delay )
67
- }
68
- }
69
-
70
55
/**
71
56
* @description 节流函数
72
57
* @param func 函数
@@ -93,10 +78,11 @@ export function throttle(func: Function, delay: number): Function {
93
78
}
94
79
}
95
80
81
+ export { debounce }
82
+
96
83
export default {
97
84
getFileType,
98
85
formatNumber,
99
86
randomString,
100
- debounce,
101
87
throttle,
102
88
}
You can’t perform that action at this time.
0 commit comments