svelte-observable
Use observables in svelte components with ease. svelte-observable wraps Observables with svelte's reactive stores so that all you have to do is {#await $...}
in your templates. This allows you to work with Observable libraries like RxJS and zen-observable with the convenience and built-in support of svelte's reactive stores.
{#await $values} Loading until first value{:then value} Will be re-rendered as values come in{:catch error} Errors are handled too{/await}
observe
Wrap an observable as a reactive store with an initial deferred value for compatibility with {#await ...}
.
Wrapped observables return a chain of promises in one of three promise states:
- pending - No value or error has been received yet
- fulfilled - Received a value
- rejected - Received an error
{#await $results_store} pending - No value or error has been received yet{:then result} fulfilled - Received a value{:catch error} rejected - Received an error{/await}
flat
Flatten a store/observable of stores/observables, unsubscribing from the previous store/observable as new values come in. This method is similar to switchMap
in RxJS.
search.set(e.target.value)} /> {#await $results} Loading...{:then results} {results}{:catch error} {error}{/await}