9.2.0 • Published 10 months ago

@zestia/ember-simple-infinite-scroller v9.2.0

Weekly downloads
1,084
License
MIT
Repository
github
Last release
10 months ago

@zestia/ember-simple-infinite-scroller

Latest npm release Ember Observer

This Ember addon provides a simple component that fires an action whenever it is scrolled to the bottom. Allowing you to load more data.

Installation

ember install @zestia/ember-simple-infinite-scroller

Demo

https://zestia.github.io/ember-simple-infinite-scroller

Example

<InfiniteScroller @onLoadMore={{this.loadMore}} as |scroller|>
  {{#each things as |thing|}}
    ...
  {{/each}}
  {{if scroller.isLoading 'Please wait...'}}
</InfiniteScroller>

Features

  • Very simple! ✔︎
  • Not coupled to Ember Data ✔︎
  • Supports use with FastBoot ✔︎

Notes

  • This addon intentionally does not come with any styles.

InfiniteScroller

Arguments

@onLoadMore

Required. Fired when the the element has been scrolled to the specified @percent.

@element

Optional. By default the scroll position of the component's own DOM element is monitored. You can use this argument to change the element, to monitor the document for example.

@percent

Optional. The distance that has to be scrolled before the load more action is fired. Defaults to 100%

@debounce

Optional. Milliseconds delay for when to check if more needs to be loaded. Defaults to every 100ms

API

isLoading

Whether the promise for more data has resolved yet

isScrollable

Whether the element is overflowing or not. If it's not, then the user will not be able to scroll to load more. In such a case, you can use this boolean to provide a button to manually load more.

loadMore

Call this to manually load more

Testing

A test helper is provided to help scrolling your element

import { scrollToPercentage } from '@zestia/ember-simple-infinite-scroller/test-support/helpers';

test('loading more', async function () {
  await visit('/');
  await scrollToPercentage('.infinite-scroller', 100);
  // ...
});

Performance

Please read: https://github.com/TryGhost/Ghost/issues/7934

You may need to add the below code to app/app.js

customEvents = {
  touchstart: null,
  touchmove: null,
  touchend: null,
  touchcancel: null
};
9.2.0

10 months ago

9.0.0-0

2 years ago

9.1.0

2 years ago

9.0.0

2 years ago

8.1.0

3 years ago

8.0.2

3 years ago

8.0.1

3 years ago

8.0.0

3 years ago

8.0.0-beta.0

3 years ago

7.0.5

4 years ago

7.0.4

4 years ago

7.0.3

4 years ago

7.0.2

4 years ago

7.0.1

4 years ago

7.0.0

4 years ago

6.0.6

4 years ago

6.0.5

4 years ago

6.0.4

4 years ago

6.0.3

4 years ago

6.0.2

4 years ago

6.0.1

4 years ago

6.0.0

4 years ago

4.0.2

4 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.10

5 years ago

3.0.9

5 years ago

3.0.8

5 years ago

3.0.7

5 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.0

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago