Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mweghorst committed Oct 24, 2023
2 parents 5d7c249 + bacf402 commit 6f192b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/rxjs/toObserver/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Sugar function to convert a `ref` into an RxJS [Observer](https://rxjs.dev/guide
import { ref } from 'vue'
import { from, fromEvent, toObserver, useSubscription } from '@vueuse/rxjs'
import { interval } from 'rxjs'
import { map, mapTo, takeUntil, withLatestFrom } from 'rxjs/operators'
import { map, mapTo, startWith, takeUntil, withLatestFrom } from 'rxjs/operators'

const count = ref(0)
const button = ref<HTMLButtonElement>(null)
Expand All @@ -23,7 +23,7 @@ useSubscription(
mapTo(1),
takeUntil(fromEvent(button, 'click')),
withLatestFrom(from(count).pipe(startWith(0))),
map(([total, curr]) => curr + total),
map(([curr, total]) => curr + total),
)
.subscribe(toObserver(count)), // same as ).subscribe(val => (count.value = val))
)
Expand Down

0 comments on commit 6f192b5

Please sign in to comment.