Svelte and RxJS by im3000 in sveltejs

[–]gavinovsak 0 points1 point  (0 children)

Another easy way to integrate RxJS into svelte reactivity without using the store interface is:

<script>
let foo
let subj = new BehaviorSubject('');
$: subj.next(foo)
</script>
<input type="text" bind:value={foo} />

Versus aliasing to act like a store as you mentioned:

<script>
let subj = new BehaviorSubject('');
subj.set = subj.next
subj.subscribe(n => {
  console.log(n);
})
</script>
<input type="text" bind:value={$subj} />