From 4dbaaa9c895b4dec1c51921283a367adec0108ac Mon Sep 17 00:00:00 2001 From: Shaban-Eissa Date: Mon, 27 May 2024 22:24:52 +0300 Subject: [PATCH] refactor: adding more real world examples for throttling --- 4.implement-basic-throttle.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/4.implement-basic-throttle.md b/4.implement-basic-throttle.md index 7ac896a..9f44a26 100644 --- a/4.implement-basic-throttle.md +++ b/4.implement-basic-throttle.md @@ -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. + +
+ What is Difference between throttle and debounce ? - Throttle: Executes the function at regular intervals, controlling the rate at which it runs over time.