export function debounce(_this: any, fn: (arg0: any) => void) {
  // 用rAF去做防抖
  return function (...args: any) {
    if (_this.lock) return;
    const run = function () {
      // requestIdleCallback-任务调度
      window.requestIdleCallback(function (deadline) {
        _this.lock = true;
        // 判断空闲时间
        // 显示器刷新频率HZ 16.7ms内不会重复执行
        if (deadline.timeRemaining() > 1000 / 60) {
          fn(...args);
          _this.lock = false;
        } else {
          run();
        }
      });
    };
    run();
  };
}
