Skip to content

Commit 21df1e1

Browse files
committed
Inserting hasMore propertie
1 parent 6dc2286 commit 21df1e1

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ yarn install && yarn start
5757

5858
## Properties
5959

60-
Raw component props (before transform):
61-
62-
| Prop | Type | Description |
63-
| ------------- | ------ | -------------------------- |
64-
| threshold | number | Threshold to call loadMore |
65-
| elementScroll | node | Element to bind scroll |
66-
| loadMore | func | Call with offset |
60+
Component props:
61+
62+
| Prop | Type | Description |
63+
| ------------- | ------ | ----------------------------------------- |
64+
| threshold | number | Threshold to call loadMore |
65+
| elementScroll | node | Element to bind scroll |
66+
| hasMore | bool | Tells you if there are more items to load |
67+
| loadMore | func | Call with offset |
6768

6869
## NPM Statistics
6970

src/index.svelte

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
export let threshold = 0;
55
export let elementScroll;
6+
export let hasMore = true;
67
78
const dispatch = createEventDispatcher();
89
let isLoadMore = false;
@@ -22,7 +23,7 @@
2223
e.target.scrollHeight - e.target.clientHeight - e.target.scrollTop;
2324
2425
if (offset <= threshold) {
25-
if (!isLoadMore) {
26+
if (!isLoadMore && hasMore) {
2627
dispatch("loadMore");
2728
}
2829
isLoadMore = true;

0 commit comments

Comments
 (0)