1
0
mirror of synced 2025-01-31 04:13:50 +01:00

Merge branch 'new-songs-ui' of https://github.com/asesidaa/TaikoLocalServer into new-songs-ui

This commit is contained in:
shiibe 2024-06-05 21:00:49 -04:00
commit 87dd13aa45

View File

@ -63,6 +63,30 @@ public partial class Users
}
}
private CancellationTokenSource? cts;
private async Task Debounce(Func<Task> action, int delayInMilliseconds)
{
// Cancel the previous task
cts?.Cancel();
// Create a new CancellationTokenSource
cts = new CancellationTokenSource();
try
{
// Wait for the delay
await Task.Delay(delayInMilliseconds, cts.Token);
// Execute the action
await action();
}
catch (TaskCanceledException)
{
// Ignore the exception
}
}
private async Task OnSearch(string search)
{
searchTerm = search;