forked from MicrosoftDocs/WindowsCommunityToolkitDocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DispatcherQueueTimerExtensions.xml
67 lines (66 loc) · 4.26 KB
/
DispatcherQueueTimerExtensions.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<Type Name="DispatcherQueueTimerExtensions" FullName="CommunityToolkit.WinUI.UI.DispatcherQueueTimerExtensions">
<TypeSignature Language="C#" Value="public static class DispatcherQueueTimerExtensions" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit DispatcherQueueTimerExtensions extends System.Object" />
<TypeSignature Language="DocId" Value="T:CommunityToolkit.WinUI.UI.DispatcherQueueTimerExtensions" />
<TypeSignature Language="VB.NET" Value="Public Module DispatcherQueueTimerExtensions" />
<TypeSignature Language="F#" Value="type DispatcherQueueTimerExtensions = class" />
<AssemblyInfo>
<AssemblyName>CommunityToolkit.WinUI</AssemblyName>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>
Set of extension methods for using <see cref="T:Microsoft.UI.Dispatching.DispatcherQueueTimer" />.
</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName="Debounce">
<MemberSignature Language="C#" Value="public static void Debounce (this Microsoft.UI.Dispatching.DispatcherQueueTimer timer, Action action, TimeSpan interval, bool immediate = false);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Debounce(class Microsoft.UI.Dispatching.DispatcherQueueTimer timer, class System.Action action, valuetype System.TimeSpan interval, bool immediate) cil managed" />
<MemberSignature Language="DocId" Value="M:CommunityToolkit.WinUI.UI.DispatcherQueueTimerExtensions.Debounce(Microsoft.UI.Dispatching.DispatcherQueueTimer,System.Action,System.TimeSpan,System.Boolean)" />
<MemberSignature Language="VB.NET" Value="<Extension()>
Public Sub Debounce (timer As DispatcherQueueTimer, action As Action, interval As TimeSpan, Optional immediate As Boolean = false)" />
<MemberSignature Language="F#" Value="static member Debounce : Microsoft.UI.Dispatching.DispatcherQueueTimer * Action * TimeSpan * bool -> unit" Usage="CommunityToolkit.WinUI.UI.DispatcherQueueTimerExtensions.Debounce (timer, action, interval, immediate)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>CommunityToolkit.WinUI</AssemblyName>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="timer" Type="Microsoft.UI.Dispatching.DispatcherQueueTimer" RefType="this" />
<Parameter Name="action" Type="System.Action" />
<Parameter Name="interval" Type="System.TimeSpan" />
<Parameter Name="immediate" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="timer">Timer instance, only one debounced function can be used per timer.</param>
<param name="action">Action to execute at the end of the interval.</param>
<param name="interval">Interval to wait before executing the action.</param>
<param name="immediate">Determines if the action execute on the leading edge instead of trailing edge.</param>
<summary>
<para>Used to debounce (rate-limit) an event. The action will be postponed and executed after the interval has elapsed. At the end of the interval, the function will be called with the arguments that were passed most recently to the debounced function.</para>
<para>Use this method to control the timer instead of calling Start/Interval/Stop manually.</para>
<para>A scheduled debounce can still be stopped by calling the stop method on the timer instance.</para>
<para>Each timer can only have one debounced function limited at a time.</para>
</summary>
<remarks>To be added.</remarks>
<example>
<code>
private DispatcherQueueTimer _typeTimer = DispatcherQueue.GetForCurrentThread().CreateTimer();
_typeTimer.Debounce(async () =>
{
// Only executes this code after 0.3 seconds have elapsed since last trigger.
}, TimeSpan.FromSeconds(0.3));
</code>
</example>
</Docs>
</Member>
</Members>
</Type>