vuejs/vue-rx

BehaviorSubject.next is not a function.

kepoddx opened this issue · 3 comments

I tried to add a BehaviorSubject to a single file component but when I call next on it, I get an error "this.dataSet$.next is not a function". I also tried adding BehaviorSubject to the Vue.use(VueRx, { BehaviorSubject }. What am I doing wrong?

export default {
....,
subscriptions() {
return {
dataSet$: new BehaviorSubject({})
}
}

this.dataSet$.next(jsonArr) throws and error

regou commented

subscriptions is a subscribe helper. So dataSet$’s type is Rx.Subscription

So I can't use a BehaviorSubject?

regou commented

No.
I don’t know why you need a BehaviorSubject. $createObservableMethod convers function to Observable. Is this what you want?

Besides, If you don’t feel convenient enough, you can always use rx without vue-rx, Just use $subscribeTo to help you auto unsubscribe