Performance upgrade for Debounce/Throttle

This commit is contained in:
2023-07-27 13:55:44 +02:00
parent d26401948a
commit 9171a3de54
6 changed files with 97 additions and 166 deletions

View File

@@ -12,6 +12,12 @@ public static class DeclarativePropertyExtensions
public static IDeclarativeProperty<T> Debounce<T>(this IDeclarativeProperty<T> from, Func<TimeSpan> interval, bool resetTimer = false)
=> new DebounceProperty<T>(from, interval) {ResetTimer = resetTimer};
public static IDeclarativeProperty<T> Throttle<T>(this IDeclarativeProperty<T> from, TimeSpan interval)
=> new ThrottleProperty<T>(from, () => interval);
public static IDeclarativeProperty<T> Throttle<T>(this IDeclarativeProperty<T> from, Func<TimeSpan> interval)
=> new ThrottleProperty<T>(from, interval);
public static IDeclarativeProperty<T> DistinctUntilChanged<T>(this IDeclarativeProperty<T> from)
=> new DistinctUntilChangedProperty<T>(from);