首页 > 其他分享 >处理报错 ResizeObserver loop completed with undelivered notifications.

处理报错 ResizeObserver loop completed with undelivered notifications.

时间:2024-04-26 09:45:36浏览次数:25  
标签:const completed args undelivered callback tid 报错 ResizeObserver any

// 处理报错 ResizeObserver loop completed with undelivered notifications.
export const handlerResizeObserverError = () => {
  const debounce = (callback: (...args: any[]) => void, delay: number) => {
    let tid: any;
    return function (...args: any[]) {
      const ctx = self;
      tid && clearTimeout(tid);
      tid = setTimeout(() => {
        callback.apply(ctx, args)
      }, delay)
    }
  }

  const _ = (window as any).ResizeObserver;
  (window as any).ResizeObserver = class ResizeObserver extends _ {
    constructor(callback: (...args: any[]) => void) {
      callback = debounce(callback, 20)
      super(callback)
    }
  }
}

 

标签:const,completed,args,undelivered,callback,tid,报错,ResizeObserver,any
From: https://www.cnblogs.com/Man-Dream-Necessary/p/18159271

相关文章