-
-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable Latency #247
Comments
Can you describe in other words please? I honestly didn't understand what your use-case/requirement is. |
Thanks for answering ... the use case would be that I have to make a request to a server when a container resizes ... during resizing it's the problem that the request is made on every pixel-change ... so when resizing from 100 to 200 px there are 200 calls made ... Do you know what I mean? |
I see, but I'd rather see that feature outside of this library. What you need is basically a debounce. For example this library: https://github.com/component/debounce Example: import { debounce } from "debounce";
new ResizeSensor(debounce(() => {
console.log('This is now called max 1 times per second, no matter how many times you resize me');
}, 1000)); |
Ok, thought it would be a great feature to configure within your library |
Actually, we could do it and per default debounce to 100ms or so to increase performance. I'll keep that issue open 👍 |
Bump+1 |
Hi,
would be great if there would be a setting where a latency / timeframe can be defined so when making e.g. AJAX requests they are done after this timeframe of no change in size.
If the framne is 50ms all actions on the resize event happens only if there is no resize for 50ms ... especially useful when manually resizing a container.
The text was updated successfully, but these errors were encountered: