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...')