Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jatinhemnani01/svelte-infinite-scrolling
Infinite Scroll for your Svelte Project.
https://github.com/jatinhemnani01/svelte-infinite-scrolling
Last synced: 20 days ago
JSON representation
Infinite Scroll for your Svelte Project.
- Host: GitHub
- URL: https://github.com/jatinhemnani01/svelte-infinite-scrolling
- Owner: jatinhemnani01
- Created: 2021-04-24T14:10:48.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-26T18:43:29.000Z (over 3 years ago)
- Last Synced: 2024-11-29T18:41:46.505Z (about 1 month ago)
- Language: Svelte
- Homepage: https://www.npmjs.com/package/svelte-infinite-scrolling
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Svelte Infinite Scrolling
Infinite Scroll Component for Svelte.
## Installation
```bash
npm i svelte-infinite-scrolling
```## Demo [link](https://svelte-infinite-example.netlify.app/)
## Examples
An example of how to use the library:
```js
import { onMount } from "svelte";
import InfiniteScroll from "./InfiniteScroll.svelte";
let posts = [];
async function getPosts() {
let res = await fetch("https://meme-api.herokuapp.com/gimme/10");
let data = await res.json();
posts = [...posts, ...data.memes];
console.log(posts);
}
onMount(() => {
getPosts();
});{#each posts as item}
{item.title}
{/each}```
## Properties
Component props:
| Prop | Type | Default | Description |
| ----------- | -------- | ------- | ---------------------------------------- |
| `on:scroll` | function | 0 | Function You Want To Run While Scrolling |### [Buy Me A Coffee](https://www.buymeacoffee.com/jatinhemnani01)