New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-infinity

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-infinity

Simple, flexible infinite scroll for Ember CLI Apps.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.1K
decreased by-37.58%
Maintainers
1
Weekly downloads
 
Created
Source

Ember Infinity

Build Status

Simple, flexible infinite scrolling for Ember CLI Apps. Works out of the box with the Kaminari Gem.

Inspired by @bantic's Ember Infinite Scroll repo, but without using controllers, in preparation for Ember 2.0.

Installation

ember install:addon ember-infinity

Basic Usage

import Ember from 'ember';
import InfinityRoute from "ember-infinity/mixins/route";

export default Ember.Route.extend(InfinityRoute, {
  model() {
    /* Load pages of the Product Model, starting from page 1, in groups of 12. */
    return this.infinityModel("product", { perPage: 12, startingPage: 1 });
  }
});

Then, you'll need to add the Infinity Loader component to your template, like so:

{{#each model as |product|}}
  <h1>{{product.name}}</h1>
  <h2>{{product.description}}</h1>
{{/each}}

{{infinity-loader infinityModel=model}}

Now, whenever the infinity-loader is in view, it will send an action to the route (the one where you initialized the infinityModel) to start loading the next page.

When the new records are loaded, they will automatically be pushed into the Model array.

Advanced Usage

The infinity-loader component as some extra options to make working with it easy!

  • destroyOnInfinity
{{infinity-loader infinityModel=model destroyOnInfinity=true}}

Now, when the Infinity Model is fully loaded, the infinity-loader will remove itself from the page.

  • developmentMode
{{infinity-loader infinityModel=model developmentMode=true}}

This simply stops the infinity-loader from fetching triggering loads, so that you can work on its appearance.

  • loadingText & loadedText
{{infinity-loader infinityModel=model loadingText="Loading..." loadedText="Loaded!"}}

By default, the infinity-loader will just output a span showing its status.

  • reached-infinity Class Name
.infinity-loader {
  background-color: wheat;
  &.reached-infinity {
    background-color: lavender;
  }
}

When the Infinity Model loads entirely, the reached-infinity class is added to the component.

  • infinity-template Generator

ember generate infinity-template

Will install the default infinity-loader template into your host app, at app/templates/components/infinity-loader.

Keywords

FAQs

Package last updated on 22 Mar 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc