From 7b393063694605c366ff4721a5db1cb1b43a5185 Mon Sep 17 00:00:00 2001 From: Mayur Tekale <147367560+mayurr7@users.noreply.github.com> Date: Fri, 13 Sep 2024 21:07:26 +0530 Subject: [PATCH] Fix incorrect use of 'debouncing' in throttle glossary #35868 (#35872) --- files/en-us/glossary/throttle/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/glossary/throttle/index.md b/files/en-us/glossary/throttle/index.md index a864b4e0520c9fa..28d5d1388998db1 100644 --- a/files/en-us/glossary/throttle/index.md +++ b/files/en-us/glossary/throttle/index.md @@ -10,7 +10,7 @@ page-type: glossary-definition Throttling is very similar to {{glossary("debounce", "debouncing")}}. The key difference is that when invocations happen continuously, throttling ensures that the operation is still performed at a certain maximum rate, while debouncing waits indefinitely until the invocations stop for a certain amount of time. -A typical use case of debouncing is when synchronizing with another constantly-updating state. Consider a function `onScrolled`, which listens for the [`scroll`](/en-US/docs/Web/API/Document/scroll_event) event. The `scroll` event may fire as often as every pixel scrolled, so the function will be called in very short intervals. If `onScrolled` is computationally expensive, earlier invocations might block later invocations from happening on time, or block other things from executing in the meantime, leading to a noticeable {{glossary("jank")}}. In this case, we can throttle `onScrolled`, such that it can only be called at most once every 10 milliseconds: +A typical use case of throttling is when synchronizing with another constantly-updating state. Consider a function `onScrolled`, which listens for the [`scroll`](/en-US/docs/Web/API/Document/scroll_event) event. The `scroll` event may fire as often as every pixel scrolled, so the function will be called in very short intervals. If `onScrolled` is computationally expensive, earlier invocations might block later invocations from happening on time, or block other things from executing in the meantime, leading to a noticeable {{glossary("jank")}}. In this case, we can throttle `onScrolled`, such that it can only be called at most once every 10 milliseconds: 1. The first call to `onScrolled` is known as the _leading edge_. 2. For every next call to `onScrolled`, if it is within 10 milliseconds from the first call, it is in the same "batch" as the first call.