12 Matching Annotations
  1. Nov 2020
    1. In the past, I tried to create some proof of concepts with svelte, but I usually ended up missing some of the features that RxJS provides. Now that I know that they complement each other well, I will grab this combination more often
    2. Instead, we can use an RxJS Subject. The only problem is that the contract is a little bit different.
    3. It's been a while since I had to write a typeahead without RxJS but this took some time and a lot of code. The implementation also contained fewer features, as the cancellability of previous requests. Sadly, most of the time, the implementation also introduced bugs. But with RxJS, this becomes trivial. By using some RxJS operators we end up with a working typeahead, without the bugs, which is thoroughly tested, and has more features. All of this, with less code.
  2. Oct 2020
    1. this.txtQueryChanged .debounceTime(1000) // wait 1 sec after the last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value .subscribe(model => { this.txtQuery = model;
    1. With Angular 2 we can debounce using RxJS operator debounceTime() on a form control's valueChanges observable:

      What's the React/Svelte equiv. pattern for this?

    1. You can think of this as a single speaker talking at a microphone in a room full of people. Their message (the subject) is being delivered to many (multicast) people (the observers) at once.
    1. Now we can do all sorts of fancy things by piping our state updates through Rxjs operators, for example store.pipe(debounceTime(400), take(5))
    2. Indeed, this simple contract is very close to that of an ob­serv­able, such as those provided by Rxjs. set is basically equiv­a­lent to next in the ob­serv­able world.
    3. I would prefer the BehaviorSubject , which allows us to kick off with an initial value.
  3. Sep 2020
    1. For interoperability with RxJS Observables, the .subscribe method is also allowed to return an object with an .unsubscribe method, rather than return the unsubscription function directly.