Socket
Socket
Sign inDemoInstall

@zestia/ember-simple-infinite-scroller

Package Overview
Dependencies
397
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @zestia/ember-simple-infinite-scroller

Simple infinite scroller component for Ember apps


Version published
Maintainers
3
Created

Changelog

Source

8.0.0

  • Release changes from beta 8

Readme

Source

@zestia/ember-simple-infinite-scroller

This Ember addon provides a simple component that fires an action whenever it is scrolled to the bottom. Allowing you to load more data. It is not coupled to Ember-Data like some other infinite scrolling implementations.

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>

Notes

  • Does not use jQuery ✔︎
  • Ember Data Friendly ✔︎
  • Supports use with FastBoot ✔︎
  • No included styles ✔︎

Configuration

ArgumentDescriptionDefault
onLoadMoreAction to perform when the @percent scrolled is reachednull
elementMonitors the scroll position of the given elementnull
percentDistance scroll from the top for when to fire the load more action100
debounceMilliseconds delay for when to check if more needs to be loaded100

Yielded API

The component will yield a hash that provides:

PropertyDescription
setElementSets the element for which to monitor the scroll position of
isLoadingTrue when the promise for more data has not resolved yet
isScrollableTrue when scroll element is overflowing
loadMoreAction for manually loading more

Performance

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

You may need to add this to app/app.js

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

Scenario to be aware of

If your scrollable element is displaying 10 things, but they don't cause the element to overflow, then the user won't ever be able to load more - because they won't be able to scroll and therefore the onLoadMore action will never fire.

To account for this, you can display a button for manually loading more...

<InfiniteScroller @onLoadMore={{this.loadMore}} as |scroller|>
  {{#each this.things as |thing|}}
    ...
  {{/each}}

  {{#unless scroller.isScrollable}}
    <button {{on "click" scroller.loadMore}}>Load more</button>
  {{/unless}}
</InfiniteScroller>

Keywords

FAQs

Last updated on 11 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc