NetanelBasal
5/13/2017 - 6:36 PM

observer.js

class SomeService {

  constructor() {
    this.observable = Rx.Observable.create(observer => {
      this.observer = observer;
    });
  }

  setData( val ) {
    this.observer.next(val);
  }
}

const s = new SomeService();
s.observable.subscribe(console.log);

s.setData('next...')