vuejs/vue-rx

$subscribeTo won't cancel previous requests.

serkandemirel0420 opened this issue · 3 comments

           import { ajax } from 'rxjs/ajax';
           const obs$ = ajax( `http://api` );


            globalThis.vm.$subscribeTo( obs$,
                ( success ) => {
                    console.log(success);
                }
                ,
                ( error ) => {
                    console.log('Error:',error);
                },
                ( complete ) => {
                    console.log('Completed!');
                }
            );

Am i doing something wrong here?

regou commented

This is a common misunderstanding about Observable streams
I think you are seeking Unsubscribable or switchMap

"This is a prototype method added to instances. You can use it to subscribe to an observable, but let VueRx manage the dispose/unsubscribe." What does this mean in the documentation?

regou commented

@serkandemirel0420 It'll auto unsubscribe the stream when beforeDestroy the vm