I am using Subject of reactivex in an angular2 application for a signal event.
When I do something like this:
let subject1 = new Subject<string>(); let subject2 = new Subject<string>(); subject1.subscribe(data=>console.debug(data)); subject2.subscribe(data=>console.debug(data)); subject1.next("this is test event1"); subject2.next("this is test event2");
everything works fine, but I want to wait for both events to fire, and then follow some steps. I found Observable.forkJoin, but I can't get it to work with themes. Code like this does not work
Observable.forkJoin( subject1.asObservable(), subject2.asObservable() ).subscribe( data => { console.debug("THIS IS MY FJ"); console.debug(JSON.stringify(data)); }, error=>console.error(error), ()=>{ console.info('THIS IS MY FJ SUCCESS'); } );
Can you help me in this matter, please.
Best regards Krzysztof Szewczyk
source share