bloc icon indicating copy to clipboard operation
bloc copied to clipboard

question: Merge transformers

Open subzero911 opened this issue 3 years ago • 2 comments

Description

How can I apply multiple transformers to the same incoming event stream? Say, I want to apply sequential(), but I also want to apply debounce.

subzero911 avatar Feb 21 '22 07:02 subzero911

I've received an answer from some Korean YT channel https://www.youtube.com/watch?v=RIqfOm0hp6Q

EventTransformer<E> debounceSequential<E>(Duration duration) {
  return (events, mapper) {
    return sequential<E>().call(events.debounce(duration), mapper);
  };
}

Should be in the manual, I believe!

subzero911 avatar Feb 21 '22 13:02 subzero911

Hi @subzero911 👋 Thanks for opening an issue and glad you found a solution. A variation of this is included as part of the GitHub Search Example and you can see another example in the VGVentures Bloc Concurrency Demos Repo.

I'll update the core concepts shortly 👍

felangel avatar Feb 21 '22 22:02 felangel