Skip to content

webermarci/svelte-store-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

A svelte library that helps with fetching and caching.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •