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 - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

29

addon/components/infinity-loader.js

@@ -15,4 +15,6 @@ import Ember from 'ember';

developmentMode: false,
scrollable: null,
didInsertElement: function() {
this._setupScrollable();
this.set('guid', Ember.guidFor(this));

@@ -29,3 +31,3 @@ this._bindScroll();

var _this = this;
Ember.$(window).on("scroll."+this.get('guid'), function() {
this.get("scrollable").on("scroll."+this.get('guid'), function() {
Ember.run.debounce(_this, _this._checkIfInView, _this.get('scrollDebounce'));

@@ -36,10 +38,11 @@ });

_unbindScroll: function() {
Ember.$(window).off("scroll."+this.get('guid'));
this.get("scrollable").off("scroll."+this.get('guid'));
},
_checkIfInView: function() {
var selfOffset = this.$().offset().top;
var windowBottom = Ember.$(window).height() + Ember.$(window).scrollTop();
var selfOffset = this.$().offset().top;
var scrollable = this.get("scrollable");
var scrollableBottom = scrollable.height() + scrollable.scrollTop();
var inView = selfOffset < windowBottom ? true : false;
var inView = selfOffset < scrollableBottom ? true : false;

@@ -51,2 +54,18 @@ if (inView && !this.get('developmentMode')) {

_setupScrollable: function() {
var scrollable = this.get('scrollable');
if (Ember.$.type(scrollable) === 'string') {
var items = Ember.$(scrollable);
if (items.length === 1) {
this.set('scrollable', items.eq(0));
} else if (items.length > 1) {
throw new Error("Multiple scrollable elements found for: " + scrollable);
} else {
throw new Error("No scrollable element found for: " + scrollable);
}
} else {
this.set('scrollable', Ember.$(window));
}
},
loadedStatusDidChange: Ember.observer('infinityModel.reachedInfinity', 'destroyOnInfinity', function() {

@@ -53,0 +72,0 @@ if (this.get('infinityModel.reachedInfinity') && this.get('destroyOnInfinity')) { this.destroy(); }

2

package.json
{
"name": "ember-infinity",
"version": "0.0.2",
"version": "0.0.3",
"description": "Simple, flexible infinite scroll for Ember CLI Apps.",

@@ -5,0 +5,0 @@ "directories": {

@@ -95,2 +95,11 @@ # Ember Infinity

Will install the default `infinity-loader` template into your host app, at
`app/templates/components/infinity-loader`.
`app/templates/components/infinity-loader`.
* **scrollable**
```html
{{infinity-loader scrollable="#content"}}
```
You can optionally pass in a jQuery style selector string. If it's not a string,
scrollable will default to using the window for the scroll binding.
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