platform/core/queue/test/helpers/subscription.dart

21 lines
440 B
Dart
Raw Normal View History

import 'package:angel3_reactivex/subjects.dart';
import 'app_event.dart';
typedef Responder<T> = void Function(T event);
class Subscription {
final BehaviorSubject<AppEvent> _subject;
Subscription(this._subject);
void respond<T>(Responder<T> responder) {
_subject.stream.where((event) => event is T).listen((event) {
responder(event as T);
});
}
void dispose() {
// Implement disposal logic if needed
}
}