From 5eaf1f4983f878de9fd12cb045ef9b54594c253b Mon Sep 17 00:00:00 2001 From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com> Date: Mon, 25 Nov 2024 17:25:29 -0800 Subject: [PATCH] Add additional notes/details about how to use the DispatcherQueueTimer.Debounce method to the docs --- .../Extensions/samples/DispatcherQueueTimerExtensions.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/Extensions/samples/DispatcherQueueTimerExtensions.md b/components/Extensions/samples/DispatcherQueueTimerExtensions.md index 96f904e0..266b0053 100644 --- a/components/Extensions/samples/DispatcherQueueTimerExtensions.md +++ b/components/Extensions/samples/DispatcherQueueTimerExtensions.md @@ -14,6 +14,14 @@ icon: Assets/Extensions.png The `DispatcherQueueTimerExtensions` static class provides a collection of extensions methods for [`DispatcherQueueTimer`](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.dispatching.dispatcherqueue) objects that make it easier to execute code on a specific UI thread at a specific time. +> [!WARNING] +> You should exclusively use the `DispatcherQueueTimer` instance calling `Debounce` for the purposes of Debouncing one specific action/scenario only and not configure it for other additional uses. + +For each sceario that you want to Debounce, you'll want to create a separate `DispatcherQueueTimer` instance to track that specific scenario. For instance, if the below samples were both within your application. You'd need two separate timers to track debouncing both scenarios. One for the keyboard input, and a different one for the mouse input. + +> [!NOTE] +> Using the `Debounce` method will set `DispatcherQueueTimer.IsRepeating` to `false` to ensure proper operation. Do not change this value. + ## Syntax The `DispatcherQueueTimerExtensions` static class currently exposes a single extension method, `Debounce`. This is a standard technique used to rate-limit input from a user to not overload requests on an underlying service of query elsewhere.