Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webermarci/svelte-store-fetcher
A svelte library that helps with fetching and caching.
https://github.com/webermarci/svelte-store-fetcher
cache fetch svelte svelte-store typescript
Last synced: 10 days ago
JSON representation
A svelte library that helps with fetching and caching.
- Host: GitHub
- URL: https://github.com/webermarci/svelte-store-fetcher
- Owner: webermarci
- License: mit
- Created: 2021-02-23T19:33:22.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T22:07:09.000Z (3 months ago)
- Last Synced: 2024-10-24T10:54:26.901Z (3 months ago)
- Topics: cache, fetch, svelte, svelte-store, typescript
- Language: TypeScript
- Homepage:
- Size: 78.1 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Svelte Store Fetcher
[![npm version](https://badge.fury.io/js/svelte-store-fetcher.svg)](https://badge.fury.io/js/svelte-store-fetcher)
This package helps you with fetching and caching responses with rarely showing the loading state.
It's based on [Tim's original implementation](https://github.com/cstrnt/modern-fetch-with-svelte).
## Usage
```bash
yarn add -D svelte-store-fetchernpm install --save-dev svelte-store-fetcher
``````html
import { get } from "svelte-store-fetcher";
const response = get("https://rickandmortyapi.com/api/character/1", 5000);{#await $response}
Loading
{:then data}
{JSON.stringify(data)}
{:catch}
Error
{/await}```