svelte-store-fetcher
TypeScript icon, indicating that this package has built-in type declarations

1.5.6 • Public • Published

Svelte Store Fetcher

npm version

This package helps you with fetching and caching responses with rarely showing the loading state.

It's based on Tim's original implementation.

Usage

yarn add -D svelte-store-fetcher

npm install --save-dev svelte-store-fetcher
<script>
  import { get } from "svelte-store-fetcher";
  const response = get("https://rickandmortyapi.com/api/character/1", 5000);
</script>

<main>
  {#await $response}
    <h1>Loading</h1>
  {:then data}
    <code>{JSON.stringify(data)}</code>
  {:catch}
    <h1>Error</h1>
  {/await}
</main>

Readme

Keywords

Package Sidebar

Install

npm i svelte-store-fetcher

Weekly Downloads

1

Version

1.5.6

License

MIT

Unpacked Size

5.14 kB

Total Files

5

Last publish

Collaborators

  • webermarci