Does anyone know a way to customize an observable.
I would like to do a http.get and send my data into an observable Obs.next(resp.json()).
In case there’s an error then retry but trigger a custom event on my observable so that i can notify the user it will retry. Obs.custom()
And after 5 times trigger Obs.error(err) and stop
Events would solve my issue but i dont want it system wide.
Observable side
Obs.next(mydate);
Obs.customEvent(y)
Obs.error(err);
Consuming side
foo.subscribe(
(x)=>{ Handle my data },
(y)=>{ console.log('custom stuff');},
(error=>{ handle error}
);
Thanks,