https://github.com/pcpl2/infinite-scroll-mithril
Infinity scroll component for mithril.js
https://github.com/pcpl2/infinite-scroll-mithril
front front-end front-end-development infinite mithril nojquery scroll web-development
Last synced: 5 months ago
JSON representation
Infinity scroll component for mithril.js
- Host: GitHub
- URL: https://github.com/pcpl2/infinite-scroll-mithril
- Owner: pcpl2
- License: bsd-2-clause
- Created: 2021-09-07T21:39:58.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-12T22:50:48.000Z (over 4 years ago)
- Last Synced: 2025-09-26T18:46:18.046Z (8 months ago)
- Topics: front, front-end, front-end-development, infinite, mithril, nojquery, scroll, web-development
- Language: JavaScript
- Homepage: https://github.com/pcpl2/infinite-scroll-mithril
- Size: 5.86 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
infinite-scroll-mithril
[](https://github.com/pcpl2/infinite-scroll-mithril)
[](https://github.com/pcpl2/infinite-scroll-mithril/blob/main/LICENSE)
[](https://www.npmjs.com/package/infinite-scroll-mithril)
Infinity scroll component for mithril
Compatible with Mithril 2.x
## Installation
Use as npm module:
```
npm install infinite-scroll-mithril
```
or download/clone from Github.
## Supported Browsers
This component has required [IntersectionObserver API](https://caniuse.com/?search=IntersectionObserver) to works.
| [
](http://godban.github.io/browsers-support-badges/)Edge | [
](http://godban.github.io/browsers-support-badges/)Firefox | [
](http://godban.github.io/browsers-support-badges/)Chrome | [
](http://godban.github.io/browsers-support-badges/)Safari | [
](http://godban.github.io/browsers-support-badges/)Opera
| --- | --- | --- | --- | --- |
| Edge 16+ | 55+ | 58+ | 12.1+ | 45+ |
## How to use
Example avaiable on [codesandbox.io](https://codesandbox.io/s/infinite-scroll-mithril-example-lxgub)
### Options
| **Parameter** | **Mandatory** | **Type** | **Default** | **Description** |
| ------------- | -------------- | -------- | ----------- | --------------- |
| **preload** | optional | Boolean | | Initial loading first page |
| **pageCount** | required | Number | 0 | Number of elements per page |
| **loadingFooter** | optional | Mithril object | | Element visible under the list while loading |
| **pageRequest** | required | Function `(page: Number) => Promise` | | Function that fetches data; accepts a page number and returns a promise |
| **processPageData** | required | Function `(data: Array) => Array` | | Function that creates a Mithril element from received data |