DEV Community

Discussion on: Intro to RxJS Concepts with Vanilla JavaScript

Collapse
 
kishmu profile image
kishmu

Thanks for the article. It is well written.

One comment: Arrow function may not work when it uses 'this'.

pipe: operator => {
    return operator(this)
  }

Changing it to function works

pipe: function(operator) {
    return operator(this)
  }

Another fix in the line to pass the event instead of event.clientX

const observable = {
  subscribe: observer => {
    document.addEventListener('click', event => {
      observer.next(event);
    });
  },
Collapse
 
creeland profile image
Cree

Good catches! I forgot about the scope differences between => and function