Closed waqas7803 closed 7 years ago
Those linked docs don't fully explain what it provides, can you describe further?
We do provide a semi-private API called lift()
. Every prototype-based operator uses it, which could be used as a one piece to create debugging tools (in addition to stubbing other things, if you want a fuller picture).
A demo of using lift to add operator logging can be found here in the tests.
@jayphelps : Problem with overriding lift is that it only allows to log observables that is applied to some operator. Please have a look here for me detail http://stackoverflow.com/questions/40675631/rx-js-5-using-lift-to-log-observable-data-for-debugging
Thanks
For RX-JS If i override lift , it becomes possible to inject behaviors into all observers in an operator chain , But how can i log RX-Observables those are not applied to any operator yet ?.
And is it proper way to log all observables to override lift and subscribe to each observables for logging data , Because do operator did not work.
This is how i am trying
const _lift = Rx.Observable.prototype.lift; var idCounter = 0; Rx.Observable.prototype.lift = function (operator) { var sourceObs = this ; sourceObs.id = ++idCounter; var resultantObservable = _lift.call(sourceObs, operator); resultantObservable.id = ++idCounter; // In this Method i log data LogObserver(operator , sourceObs , resultantObservable); return resultantObservable; }; Above code works for
var timer = Rx.Observable.interval(1000).take(4); But does not work for
var sequence = Rx.Observable.range(1, 10); Thanks in advance.
Best Regards
Closing as inactive. while it is interesting idea, I don't think core 5 will going to have this. Probably best way for userlevel approach is hook lift as suggested as well as hook static creations methods.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Is there any function in RX-JS that serve same as we have .spy in Bacon.js. https://github.com/baconjs/bacon.js/#bacon-spy
Or any other way to achieve same functionality ?
I need that to create Debugging tool for RX-JS.
Best Regards