interval method
the callback
will be called every certain time interval ignoring the other changes
Implementation
RxReaction interval(Duration duration, void Function(T) callback) {
var debouncer = Debouncer(duration);
// ignore: cancel_subscriptions
final StreamSubscription subscription = stream.listen((event) {
if (!debouncer.isRunning) {
debouncer.call(() {
callback(event);
debouncer = Debouncer(duration);
});
}
});
return RxReaction(subscription, debouncer);
}