mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 09:57:46 +00:00
14 lines
256 B
Dart
14 lines
256 B
Dart
|
import 'dart:async';
|
||
|
import 'package:flutter/foundation.dart';
|
||
|
|
||
|
class Debounce {
|
||
|
Debounce(this.duration);
|
||
|
|
||
|
final Duration duration;
|
||
|
Timer _timer;
|
||
|
|
||
|
void run(VoidCallback action) {
|
||
|
_timer?.cancel();
|
||
|
_timer = Timer(duration, action);
|
||
|
}
|
||
|
}
|