You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are numerous events in JavaScript that can get triggered repeatedly, necessitating that developers write additional code to throttle these events. For example:
The Network Information API change event fires whenever a network change occurs, but this can happen in rapid succession when users pass through tunnels or move from WiFi to a cellular network. In almost all use cases, only the last event in the series is truly relevant.
The resize event is fired repeatedly when a window corner is dragged to resize the browser application. In almost all cases, a developer who wants to know when a resize has occurred—so they can adjust the user experience in a responsive context—only cares about the final event.
The change event on an input fires repeatedly when a user is typing, but for expensive operations like API lookups based on the entered content, developers will only want to trigger the API call when the user pauses for a bit or stops typing altogether.
The mousemove event fires much faster than movement is perceivable by the human eye, so it would be useful to be able to throttle it to a lower frequency (e.g., 20 Hz).
I want a native way to configure these (and similar) events to fire less frequently without having to write the debouncing and throttling code myself.
This discussion was converted from issue #110 on October 29, 2020 00:13.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There are numerous events in JavaScript that can get triggered repeatedly, necessitating that developers write additional code to throttle these events. For example:
change
event fires whenever a network change occurs, but this can happen in rapid succession when users pass through tunnels or move from WiFi to a cellular network. In almost all use cases, only the last event in the series is truly relevant.resize
event is fired repeatedly when a window corner is dragged to resize the browser application. In almost all cases, a developer who wants to know when a resize has occurred—so they can adjust the user experience in a responsive context—only cares about the final event.change
event on aninput
fires repeatedly when a user is typing, but for expensive operations like API lookups based on the entered content, developers will only want to trigger the API call when the user pauses for a bit or stops typing altogether.mousemove
event fires much faster than movement is perceivable by the human eye, so it would be useful to be able to throttle it to a lower frequency (e.g., 20 Hz).I want a native way to configure these (and similar) events to fire less frequently without having to write the debouncing and throttling code myself.
https://webwewant.fyi/wants/4/
Beta Was this translation helpful? Give feedback.
All reactions