sampleEvent method

BlocEventCallback<FastNavigationSplitViewBlocEvent<FastItem>> sampleEvent(
  1. BlocEventCallback<FastNavigationSplitViewBlocEvent<FastItem>> function, {
  2. Duration delay = const Duration(milliseconds: 300),
})
inherited

Implementation

BlocEventCallback<E> sampleEvent(
  BlocEventCallback<E> function, {
  Duration delay = const Duration(milliseconds: 300),
}) {
  final sampler = PublishSubject<Tuple2<BlocEventCallback<E>, E>>();
  publishers.add(sampler);

  subxList.add(
    sampler.sampleTime(delay).listen((Tuple2<BlocEventCallback<E>, E> tuple) {
      tuple.item1(tuple.item2);
    }),
  );

  return (E event) {
    final tuple = Tuple2<BlocEventCallback<E>, E>(function, event);
    sampler.add(tuple);
  };
}