Skip to content

Commit

Permalink
Merge 2ce398d into 492ab00
Browse files Browse the repository at this point in the history
  • Loading branch information
tomieric committed Oct 2, 2021
2 parents 492ab00 + 2ce398d commit 53d5242
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/resize-event.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ResizeObserver from 'resize-observer-polyfill';
import { debounce } from 'throttle-debounce';

const isServer = typeof window === 'undefined';

Expand All @@ -19,7 +20,7 @@ export const addResizeListener = function(element, fn) {
if (isServer) return;
if (!element.__resizeListeners__) {
element.__resizeListeners__ = [];
element.__ro__ = new ResizeObserver(resizeHandler);
element.__ro__ = new ResizeObserver(debounce(16, resizeHandler));
element.__ro__.observe(element);
}
element.__resizeListeners__.push(fn);
Expand Down

0 comments on commit 53d5242

Please sign in to comment.