index.js 501 B

1234567891011121314151617181920212223242526
  1. /*
  2. * @Author: wjc
  3. * @Date: 2024-05-11 10:50:56
  4. * @LastEditors: wjc
  5. * @LastEditTime: 2024-05-11 10:51:00
  6. * @Description:
  7. */
  8. export default class {
  9. constructor () {
  10. throw new Error('该类不能被实例化')
  11. }
  12. // 防抖动
  13. static debounce (fn, delay = 200) {
  14. let timer = null
  15. return function () {
  16. let context = this
  17. let args = arguments
  18. clearTimeout(timer)
  19. timer = setTimeout(function () {
  20. fn.apply(context, args)
  21. }, delay)
  22. }
  23. }
  24. }