Skip to content

Commit

Permalink
refactor: adding more real world examples for throttling
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaban-Eissa committed May 27, 2024
1 parent b20ce07 commit 4dbaaa9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 4.implement-basic-throttle.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ Throttling is suitable for scenarios where you want to limit how often a functio
- Updating or animating elements on the page when the user scrolls, resizes, or moves the mouse
- Logging or tracking user actions or events when they occur frequently

Here are three simple real life examples of throttling:
1. Scrolling Event: Update UI every 100ms.
2. API Rate Limiting: Send requests once per second.
3. Window Resize: Adjust layout every 200ms.
4. Button Clicks: Limit clicks to prevent multiple submissions.
5. Mouse Move Events: Update element position every 50ms.
6. Infinite Scrolling: Load content periodically.
7. Game Loops: Control frame rate for smooth performance.
8. Search Input Autocomplete: Query server every 300ms.

<br />

What is Difference between throttle and debounce ?

- Throttle: Executes the function at regular intervals, controlling the rate at which it runs over time.
Expand Down

0 comments on commit 4dbaaa9

Please sign in to comment.