-
Notifications
You must be signed in to change notification settings - Fork 6
/
DispatcherQueueTimerExtensions.xml
69 lines (68 loc) · 4.29 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
68
69
<Type Name="DispatcherQueueTimerExtensions" FullName="Microsoft.Toolkit.Uwp.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:Microsoft.Toolkit.Uwp.UI.DispatcherQueueTimerExtensions" />
<TypeSignature Language="VB.NET" Value="Public Module DispatcherQueueTimerExtensions" />
<TypeSignature Language="F#" Value="type DispatcherQueueTimerExtensions = class" />
<AssemblyInfo>
<AssemblyName>Microsoft.Toolkit.Uwp</AssemblyName>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>7.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>
Set of extension methods for using <see cref="T:Windows.System.DispatcherQueueTimer" />.
</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName="Debounce">
<MemberSignature Language="C#" Value="public static void Debounce (this Windows.System.DispatcherQueueTimer timer, Action action, TimeSpan interval, bool immediate = false);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Debounce(class Windows.System.DispatcherQueueTimer timer, class System.Action action, valuetype System.TimeSpan interval, bool immediate) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Toolkit.Uwp.UI.DispatcherQueueTimerExtensions.Debounce(Windows.System.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 : Windows.System.DispatcherQueueTimer * Action * TimeSpan * bool -> unit" Usage="Microsoft.Toolkit.Uwp.UI.DispatcherQueueTimerExtensions.Debounce (timer, action, interval, immediate)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Toolkit.Uwp</AssemblyName>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>7.1.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="timer" Type="Windows.System.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>