intermediate

This commit is contained in:
Fabian Freund
2024-12-12 09:44:33 +01:00
parent 0710116feb
commit 6b2ae28828
108 changed files with 5531 additions and 2265 deletions
+21
View File
@@ -0,0 +1,21 @@
import 'dart:async';
class Debouncer {
final Duration debounce;
Timer? _timer;
Debouncer(this.debounce);
bool get isDebouncing => _timer?.isActive ?? false;
void eventOccured(void Function() callback) {
_timer?.cancel();
_timer = Timer(debounce, callback);
}
void dispose() {
_timer?.cancel();
_timer = null;
}
}