| | |
| | | }); |
| | | } |
| | | |
| | | private static debounceStates: { [key: string]: boolean } = {}; |
| | | private static debounceTimer: { [key: string]: number } = {}; |
| | | //防快速点击函数 |
| | | static debounceClicks = (callback: () => void, identifier = 'default', delay = 1000) => { |
| | | return () => { |
| | | if (!Global.debounceStates[identifier]) { |
| | | Global.debounceStates[identifier] = true; |
| | | Global.debounceTimer[identifier] = setTimeout(() => { |
| | | Global.debounceStates[identifier] = false; |
| | | clearTimeout(Global.debounceTimer[identifier]); |
| | | }, delay); |
| | | callback(); |
| | | } |
| | | }; |
| | | }; |
| | | |
| | | } |