rxjs - How to handle progress update using ReactiveX Observables/Subjects? -


i'm writing angular app uses reactivex api handle asynchronous operations. used api before in android project , how simplifies concurrent task handling. there 1 thing i'm not sure how solve in right way.

how update observer ongoing task? task in case take time load/create complex/large object , i'm able return intermediate progress, not object itself. observable can return 1 datatype. therefor know 2 possibilities.

  1. create object has progress field , data field. object can returned observable.onnext(object). progress field update on every onnext, while data field empty until last onnext, set loaded value.

  2. create 2 observables, data observable , progress observable. observer hast subscribe progress observable progress updates , data observable notified when data loaded/created. these can optionally zipped 1 subscription.

i used both techniques, both work, want know if there unified standard, clean way, how solve task. can, of course, completly new one. im open every solution.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -