react-window-size-listener icon indicating copy to clipboard operation
react-window-size-listener copied to clipboard

Debounce seems not to be working

Open orlandovallejos opened this issue 5 years ago • 1 comments

I'm using the "DEBOUNCE_TIME" option and I set it to 5 seconds (5000), and it gets executed several times, and it seems it's not working:

https://imgur.com/a/TZMCYj5

This is what I do:

import WindowResizeListener from 'react-window-size-listener';
WindowResizeListener.DEBOUNCE_TIME = 5000;

And in the render method:
  <WindowResizeListener
    onResize={windowSize => {
      console.log('resize: ', windowSize);
      console.log('DEBOUNCE_TIME: ', WindowResizeListener.DEBOUNCE_TIME);
    }}
  />

In the gif you can see the current behavior vs a debounce example which I took from here: https://codepen.io/bencentra/pen/PwapWX

I'm using: "react-window-size-listener": "^1.5.3"

orlandovallejos avatar Sep 18 '19 21:09 orlandovallejos

Any news about this?

orlandovallejos avatar Jun 08 '20 22:06 orlandovallejos