Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular2-infinite-scroll

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-infinite-scroll - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

.eslintrc.json

51

bundles/angular2-infinite-scroll.js

@@ -28,3 +28,4 @@ System.registerDynamic("src/infinite-scroll", ["@angular/core", "./scroller"], true, function($__require, exports, module) {

this.element = element;
this._distance = 2;
this._distanceDown = 2;
this._distanceUp = 1.5;
this._throttle = 3;

@@ -34,6 +35,7 @@ this.scrollWindow = true;

this.scrolled = new core_1.EventEmitter();
this.scrolledUp = new core_1.EventEmitter();
}
InfiniteScroll.prototype.ngOnInit = function() {
var containerElement = this.scrollWindow ? window : this.element;
this.scroller = new scroller_1.Scroller(containerElement, setInterval, this.element, this.onScroll.bind(this), this._distance, {}, this._throttle, this._immediate);
this.scroller = new scroller_1.Scroller(containerElement, setInterval, this.element, this.onScrollDown.bind(this), this.onScrollUp.bind(this), this._distanceDown, this._distanceUp, {}, this._throttle, this._immediate);
};

@@ -43,9 +45,13 @@ InfiniteScroll.prototype.ngOnDestroy = function() {

};
InfiniteScroll.prototype.onScroll = function() {
InfiniteScroll.prototype.onScrollDown = function() {
this.scrolled.next({});
};
InfiniteScroll.prototype.onScrollUp = function() {
this.scrolledUp.next({});
};
InfiniteScroll.prototype.handleScroll = function(event) {
this.scroller.handler();
};
__decorate([core_1.Input('infiniteScrollDistance'), __metadata('design:type', Number)], InfiniteScroll.prototype, "_distance", void 0);
__decorate([core_1.Input('infiniteScrollDistance'), __metadata('design:type', Number)], InfiniteScroll.prototype, "_distanceDown", void 0);
__decorate([core_1.Input('infiniteScrollUpDistance'), __metadata('design:type', Number)], InfiniteScroll.prototype, "_distanceUp", void 0);
__decorate([core_1.Input('infiniteScrollThrottle'), __metadata('design:type', Number)], InfiniteScroll.prototype, "_throttle", void 0);

@@ -55,4 +61,5 @@ __decorate([core_1.Input('scrollWindow'), __metadata('design:type', Boolean)], InfiniteScroll.prototype, "scrollWindow", void 0);

__decorate([core_1.Output(), __metadata('design:type', Object)], InfiniteScroll.prototype, "scrolled", void 0);
__decorate([core_1.Output(), __metadata('design:type', Object)], InfiniteScroll.prototype, "scrolledUp", void 0);
__decorate([core_1.HostListener('scroll', ['$event']), __metadata('design:type', Function), __metadata('design:paramtypes', [Object]), __metadata('design:returntype', void 0)], InfiniteScroll.prototype, "handleScroll", null);
InfiniteScroll = __decorate([core_1.Directive({selector: '[infinite-scroll]'}), __metadata('design:paramtypes', [core_1.ElementRef])], InfiniteScroll);
InfiniteScroll = __decorate([core_1.Directive({selector: '[infinite-scroll]'}), __metadata('design:paramtypes', [Object])], InfiniteScroll);
return InfiniteScroll;

@@ -72,12 +79,14 @@ }());

var Scroller = (function() {
function Scroller(windowElement, $interval, $elementRef, infiniteScrollCallback, infiniteScrollDistance, infiniteScrollParent, infiniteScrollThrottle, isImmediate) {
function Scroller(windowElement, $interval, $elementRef, infiniteScrollDownCallback, infiniteScrollUpCallback, infiniteScrollDownDistance, infiniteScrollUpDistance, infiniteScrollParent, infiniteScrollThrottle, isImmediate) {
this.windowElement = windowElement;
this.$interval = $interval;
this.$elementRef = $elementRef;
this.infiniteScrollCallback = infiniteScrollCallback;
this.infiniteScrollDownCallback = infiniteScrollDownCallback;
this.infiniteScrollUpCallback = infiniteScrollUpCallback;
this.infiniteScrollThrottle = infiniteScrollThrottle;
this.isImmediate = isImmediate;
this.isContainerWindow = this.windowElement.hasOwnProperty('document');
this.lastScrollPosition = 0;
this.isContainerWindow = toString.call(this.windowElement).includes('Window');
this.documentElement = this.isContainerWindow ? this.windowElement.document.documentElement : null;
this.handleInfiniteScrollDistance(infiniteScrollDistance);
this.handleInfiniteScrollDistance(infiniteScrollDownDistance, infiniteScrollUpDistance);
this.handleInfiniteScrollDisabled(false);

@@ -126,4 +135,13 @@ this.defineContainer();

var container = this.calculatePoints();
var remaining = container.totalToScroll - container.scrolledUntilNow;
var containerBreakpoint = container.height * this.scrollDistance + 1;
var scrollingDown = this.lastScrollPosition < container.scrolledUntilNow;
this.lastScrollPosition = container.scrolledUntilNow;
var remaining;
var containerBreakpoint;
if (scrollingDown) {
remaining = container.totalToScroll - container.scrolledUntilNow;
containerBreakpoint = container.height * this.scrollDownDistance + 1;
} else {
remaining = container.scrolledUntilNow;
containerBreakpoint = container.height * this.scrollUpDistance + 1;
}
var shouldScroll = remaining <= containerBreakpoint;

@@ -134,3 +152,7 @@ var triggerCallback = shouldScroll && this.scrollEnabled;

if (triggerCallback) {
this.infiniteScrollCallback();
if (scrollingDown) {
this.infiniteScrollDownCallback();
} else {
this.infiniteScrollUpCallback();
}
}

@@ -169,4 +191,5 @@ if (shouldClearInterval) {

};
Scroller.prototype.handleInfiniteScrollDistance = function(scrollDistance) {
return this.scrollDistance = parseFloat(scrollDistance) || 0;
Scroller.prototype.handleInfiniteScrollDistance = function(scrollDownDistance, scrollUpDistance) {
this.scrollDownDistance = parseFloat(scrollDownDistance) || 0;
this.scrollUpDistance = parseFloat(scrollUpDistance) || 0;
};

@@ -173,0 +196,0 @@ Scroller.prototype.attachEvent = function(newContainer) {

{
"name": "angular2-infinite-scroll",
"version": "0.1.2",
"version": "0.1.3",
"description": "An infinite scroll directive for angular2",

@@ -9,3 +9,12 @@ "main": "angular2-infinite-scroll.js",

"scripts": {
"prepublish": "tsc & node make.js"
"start": "npm run build && npm run lite",
"lite": "lite-server",
"prepublish": "tsc & node make.js",
"postinstall": "typings install",
"clean": "rimraf src/*.js && rimraf src/*.d.ts && rimraf ./*scroll.js && rimraf ./*scroll.d.ts",
"build:test": "tsc --project ./src",
"watch": "tsc --project ./src --watch",
"pretest": "npm run clean && npm run build:test",
"test": "karma start karma.conf.js",
"dev": "npm run watch & npm test"
},

@@ -20,2 +29,4 @@ "keywords": [

"devDependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",

@@ -27,9 +38,21 @@ "@angular/platform-browser": "2.0.0-rc.1",

"es6-shim": "^0.33.3",
"jasmine-core": "2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^1.0.1",
"karma-cli": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-mocha-reporter": "2.0.4",
"karma-phantomjs-launcher": "1.0.0",
"lite-server": "2.2.0",
"path": "^0.12.7",
"phantomjs-prebuilt": "^2.1.7",
"reflect-metadata": "0.1.2",
"rimraf": "2.5.2",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.31",
"systemjs-builder": "^0.15.16",
"typescript": "^1.7.5",
"typings": "1.2.0",
"zone.js": "0.6.12"
}
}

@@ -0,1 +1,3 @@

[![Build Status](https://travis-ci.org/orizens/angular2-infinite-scroll.svg?branch=master)](https://travis-ci.org/orizens/angular2-infinite-scroll)
# Angular 2 Infinite Scroll

@@ -109,3 +111,13 @@ A port & modification of [ng-infinite-scroll](https://github.com/sroze/ngInfiniteScroll) directive for angular 2.

## Testing
To start developing tdd/bdd style: ```npm run dev```
This will: compile ts files, watch for changes and start the test task. Whenever a ts file is changed, it will rerun the tests.
Travis-ci is integrated
### Credits For Tests Setup
[ng2-test-seed](https://github.com/juliemr/ng2-test-seed) has been a huge help and source of inspiration. At first, copy & paste, then, customisation to adapt to this code repository.
Thanks [@juliemr](https://github.com/juliemr)!
# Showcase Examples
* [Echoes Player Ng2 Version](http://orizens.github.io/echoes-ng2) ([github repo for echoes player](http://github.com/orizens/echoes-ng2))

@@ -0,6 +1,9 @@

/// <reference path="../typings/index.d.ts" />
import { ElementRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { Scroller } from './scroller';
export declare class InfiniteScroll implements OnDestroy, OnInit {
private element;
private scroller;
_distance: number;
scroller: Scroller;
_distanceDown: number;
_distanceUp: number;
_throttle: number;

@@ -10,7 +13,9 @@ scrollWindow: boolean;

scrolled: EventEmitter<{}>;
constructor(element: ElementRef);
scrolledUp: EventEmitter<{}>;
constructor(element: ElementRef | any);
ngOnInit(): void;
ngOnDestroy(): void;
onScroll(): void;
onScrollDown(): void;
onScrollUp(): void;
handleScroll(event: any): void;
}

@@ -11,2 +11,3 @@ "use strict";

};
/// <reference path="../typings/index.d.ts" />
var core_1 = require('@angular/core');

@@ -17,3 +18,4 @@ var scroller_1 = require('./scroller');

this.element = element;
this._distance = 2;
this._distanceDown = 2;
this._distanceUp = 1.5;
this._throttle = 3;

@@ -23,6 +25,7 @@ this.scrollWindow = true;

this.scrolled = new core_1.EventEmitter();
this.scrolledUp = new core_1.EventEmitter();
}
InfiniteScroll.prototype.ngOnInit = function () {
var containerElement = this.scrollWindow ? window : this.element;
this.scroller = new scroller_1.Scroller(containerElement, setInterval, this.element, this.onScroll.bind(this), this._distance, {}, this._throttle, this._immediate);
this.scroller = new scroller_1.Scroller(containerElement, setInterval, this.element, this.onScrollDown.bind(this), this.onScrollUp.bind(this), this._distanceDown, this._distanceUp, {}, this._throttle, this._immediate);
};

@@ -32,5 +35,8 @@ InfiniteScroll.prototype.ngOnDestroy = function () {

};
InfiniteScroll.prototype.onScroll = function () {
InfiniteScroll.prototype.onScrollDown = function () {
this.scrolled.next({});
};
InfiniteScroll.prototype.onScrollUp = function () {
this.scrolledUp.next({});
};
InfiniteScroll.prototype.handleScroll = function (event) {

@@ -42,4 +48,8 @@ this.scroller.handler();

__metadata('design:type', Number)
], InfiniteScroll.prototype, "_distance", void 0);
], InfiniteScroll.prototype, "_distanceDown", void 0);
__decorate([
core_1.Input('infiniteScrollUpDistance'),
__metadata('design:type', Number)
], InfiniteScroll.prototype, "_distanceUp", void 0);
__decorate([
core_1.Input('infiniteScrollThrottle'),

@@ -61,2 +71,6 @@ __metadata('design:type', Number)

__decorate([
core_1.Output(),
__metadata('design:type', Object)
], InfiniteScroll.prototype, "scrolledUp", void 0);
__decorate([
core_1.HostListener('scroll', ['$event']),

@@ -71,3 +85,3 @@ __metadata('design:type', Function),

}),
__metadata('design:paramtypes', [core_1.ElementRef])
__metadata('design:paramtypes', [Object])
], InfiniteScroll);

@@ -77,2 +91,2 @@ return InfiniteScroll;

exports.InfiniteScroll = InfiniteScroll;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5maW5pdGUtc2Nyb2xsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW5maW5pdGUtc2Nyb2xsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSxxQkFBb0csZUFBZSxDQUFDLENBQUE7QUFDcEgseUJBQXlCLFlBQVksQ0FBQyxDQUFBO0FBS3RDO0lBVUUsd0JBQW9CLE9BQW1CO1FBQW5CLFlBQU8sR0FBUCxPQUFPLENBQVk7UUFQTixjQUFTLEdBQVcsQ0FBQyxDQUFDO1FBQ3RCLGNBQVMsR0FBVyxDQUFDLENBQUM7UUFDaEMsaUJBQVksR0FBWSxJQUFJLENBQUM7UUFDM0IsZUFBVSxHQUFZLEtBQUssQ0FBQztRQUUzQyxhQUFRLEdBQUcsSUFBSSxtQkFBWSxFQUFFLENBQUM7SUFFRSxDQUFDO0lBRTNDLGlDQUFRLEdBQVI7UUFDRSxJQUFNLGdCQUFnQixHQUFHLElBQUksQ0FBQyxZQUFZLEdBQUcsTUFBTSxHQUFHLElBQUksQ0FBQyxPQUFPLENBQUM7UUFDbkUsSUFBSSxDQUFDLFFBQVEsR0FBRyxJQUFJLG1CQUFRLENBQUMsZ0JBQWdCLEVBQUUsV0FBVyxFQUFFLElBQUksQ0FBQyxPQUFPLEVBQUUsSUFBSSxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsSUFBSSxDQUFDLFNBQVMsRUFBRSxFQUFFLEVBQ2hILElBQUksQ0FBQyxTQUFTLEVBQUUsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3pDL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ElementRef } from '@angular/core';

@@ -6,6 +7,8 @@ export declare class Scroller {

private $elementRef;
private infiniteScrollCallback;
private infiniteScrollDownCallback;
private infiniteScrollUpCallback;
private infiniteScrollThrottle;
private isImmediate;
scrollDistance: number;
scrollDownDistance: number;
scrollUpDistance: number;
scrollEnabled: boolean;

@@ -20,3 +23,4 @@ checkWhenEnabled: boolean;

private disposeScroll;
constructor(windowElement: Window | ElementRef | any, $interval: Function, $elementRef: ElementRef, infiniteScrollCallback: Function, infiniteScrollDistance: number, infiniteScrollParent: Window | ElementRef | any, infiniteScrollThrottle: number, isImmediate: boolean);
lastScrollPosition: number;
constructor(windowElement: Window | ElementRef | any, $interval: Function, $elementRef: ElementRef, infiniteScrollDownCallback: Function, infiniteScrollUpCallback: Function, infiniteScrollDownDistance: number, infiniteScrollUpDistance: number, infiniteScrollParent: Window | ElementRef | any, infiniteScrollThrottle: number, isImmediate: boolean);
defineContainer(): void;

@@ -43,3 +47,3 @@ createInterval(): void;

};
handleInfiniteScrollDistance(scrollDistance: number | any): number;
handleInfiniteScrollDistance(scrollDownDistance: number | any, scrollUpDistance: number | any): void;
attachEvent(newContainer: Window | ElementRef | any): void;

@@ -46,0 +50,0 @@ clean(): void;

"use strict";
var Rx_1 = require('rxjs/Rx');
var Scroller = (function () {
function Scroller(windowElement, $interval, $elementRef, infiniteScrollCallback, infiniteScrollDistance, infiniteScrollParent, infiniteScrollThrottle, isImmediate) {
function Scroller(windowElement, $interval, $elementRef, infiniteScrollDownCallback, infiniteScrollUpCallback, infiniteScrollDownDistance, infiniteScrollUpDistance, infiniteScrollParent, infiniteScrollThrottle, isImmediate) {
this.windowElement = windowElement;
this.$interval = $interval;
this.$elementRef = $elementRef;
this.infiniteScrollCallback = infiniteScrollCallback;
this.infiniteScrollDownCallback = infiniteScrollDownCallback;
this.infiniteScrollUpCallback = infiniteScrollUpCallback;
this.infiniteScrollThrottle = infiniteScrollThrottle;
this.isImmediate = isImmediate;
this.isContainerWindow = this.windowElement.hasOwnProperty('document');
this.lastScrollPosition = 0;
this.isContainerWindow = toString.call(this.windowElement).includes('Window');
this.documentElement = this.isContainerWindow ? this.windowElement.document.documentElement : null;
this.handleInfiniteScrollDistance(infiniteScrollDistance);
this.handleInfiniteScrollDistance(infiniteScrollDownDistance, infiniteScrollUpDistance);
// if (attrs.infiniteScrollParent != null) {

@@ -67,4 +69,14 @@ // attachEvent(angular.element(elem.parent()));

var container = this.calculatePoints();
var remaining = container.totalToScroll - container.scrolledUntilNow;
var containerBreakpoint = container.height * this.scrollDistance + 1;
var scrollingDown = this.lastScrollPosition < container.scrolledUntilNow;
this.lastScrollPosition = container.scrolledUntilNow;
var remaining;
var containerBreakpoint;
if (scrollingDown) {
remaining = container.totalToScroll - container.scrolledUntilNow;
containerBreakpoint = container.height * this.scrollDownDistance + 1;
}
else {
remaining = container.scrolledUntilNow;
containerBreakpoint = container.height * this.scrollUpDistance + 1;
}
var shouldScroll = remaining <= containerBreakpoint;

@@ -78,3 +90,8 @@ var triggerCallback = shouldScroll && this.scrollEnabled;

if (triggerCallback) {
this.infiniteScrollCallback();
if (scrollingDown) {
this.infiniteScrollDownCallback();
}
else {
this.infiniteScrollUpCallback();
}
}

@@ -112,4 +129,5 @@ if (shouldClearInterval) {

};
Scroller.prototype.handleInfiniteScrollDistance = function (scrollDistance) {
return this.scrollDistance = parseFloat(scrollDistance) || 0;
Scroller.prototype.handleInfiniteScrollDistance = function (scrollDownDistance, scrollUpDistance) {
this.scrollDownDistance = parseFloat(scrollDownDistance) || 0;
this.scrollUpDistance = parseFloat(scrollUpDistance) || 0;
};

@@ -142,1 +160,2 @@ Scroller.prototype.attachEvent = function (newContainer) {

exports.Scroller = Scroller;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzY3JvbGxlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsb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sZVNjcm9sbDtcblx0XHQvLyBpZiAodGhpcy5zY3JvbGxFbmFibGVkICYmIGNoZWNrV2hlbkVuYWJsZWQpIHtcblx0XHQvLyBcdGNoZWNrV2hlbkVuYWJsZWQgPSBmYWxzZTtcblx0XHQvLyBcdHJldHVybiBoYW5kbGVyKCk7XG5cdFx0Ly8gfVxuXHR9XG59XG4iXX0=

@@ -11,2 +11,3 @@ {

"declaration": true,
"suppressImplicitAnyIndexErrors": true,
"moduleResolution": "node"

@@ -13,0 +14,0 @@ },

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