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

ngx-infinite-scroll

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-infinite-scroll - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

117

bundles/ngx-infinite-scroll.umd.js

@@ -94,4 +94,4 @@ (function (global, factory) {

function shouldTriggerEvents(_a) {
var alwaysCallback = _a.alwaysCallback, shouldScroll = _a.shouldScroll, disable = _a.disable;
return (alwaysCallback || shouldScroll) && !disable;
var alwaysCallback = _a.alwaysCallback, shouldFireScrollEvent = _a.shouldFireScrollEvent;
return (alwaysCallback || shouldFireScrollEvent);
}

@@ -116,7 +116,4 @@ /**

function createResolver(_a) {
var isWindow = _a.isWindow, windowElement = _a.windowElement, axis = _a.axis;
return createResolverWithContainer({
axis: axis,
isWindow: isWindow
}, windowElement);
var windowElement = _a.windowElement, axis = _a.axis;
return createResolverWithContainer({ axis: axis, isWindow: isElementWindow(windowElement) }, windowElement);
}

@@ -268,3 +265,3 @@ /**

*/
function shouldScroll(container, config, scrollingDown) {
function shouldFireScrollEvent(container, config, scrollingDown) {
var /** @type {?} */ distance = config.distance;

@@ -274,11 +271,11 @@ var /** @type {?} */ remaining;

if (scrollingDown) {
remaining = container.totalToScroll - container.scrolledUntilNow;
containerBreakpoint = container.height * distance.down + 1;
remaining = (container.totalToScroll - container.scrolledUntilNow) / container.totalToScroll;
containerBreakpoint = distance.down / 10;
}
else {
remaining = container.scrolledUntilNow;
containerBreakpoint = container.height * distance.up + 1;
remaining = container.scrolledUntilNow / container.totalToScroll;
containerBreakpoint = distance.up / 10;
}
var /** @type {?} */ shouldScroll = remaining <= containerBreakpoint;
return shouldScroll;
var /** @type {?} */ shouldFireEvent = remaining <= containerBreakpoint;
return shouldFireEvent;
}

@@ -302,3 +299,3 @@ /**

return {
shouldScroll: shouldScroll(container, config, isScrollingDown),
shouldFireScrollEvent: shouldFireScrollEvent(container, config, isScrollingDown),
isScrollingDown: isScrollingDown

@@ -309,19 +306,47 @@ };

* @param {?} position
* @param {?} lastPositionState
* @param {?} scrollState
* @return {?}
*/
function updateScrollPosition(position, lastPositionState) {
return (lastPositionState.last = position);
function updateScrollPosition(position, scrollState) {
return (scrollState.lastScrollPosition = position);
}
/**
* @param {?} options
* @param {?} totalToScroll
* @param {?} scrollState
* @return {?}
*/
function attachScrollEvent(options) {
return rxjs_Observable.Observable.fromEvent(options.container, 'scroll')
.sampleTime(options.throttleDuration)
.mergeMap(function (ev) { return rxjs_Observable.Observable.of(options.mergeMap(ev)); })
.subscribe(options.scrollHandler);
function updateTotalToScroll(totalToScroll, scrollState) {
scrollState.lastTotalToScroll = scrollState.totalToScroll;
scrollState.totalToScroll = totalToScroll;
}
/**
* @param {?} scrollState
* @return {?}
*/
function isSameTotalToScroll(scrollState) {
return scrollState.totalToScroll === scrollState.lastTotalToScroll;
}
/**
* @param {?} scrollState
* @param {?} triggered
* @return {?}
*/
function updateTriggeredFlag(scrollState, triggered) {
scrollState.isTriggeredTotal = triggered;
}
/**
* @param {?} scrollState
* @param {?} scrolledUntilNow
* @param {?} totalToScroll
* @return {?}
*/
function updateScrollState(scrollState, scrolledUntilNow, totalToScroll) {
updateScrollPosition(scrolledUntilNow, scrollState);
updateTotalToScroll(totalToScroll, scrollState);
var /** @type {?} */ isSameTotal = isSameTotalToScroll(scrollState);
if (!isSameTotal) {
updateTriggeredFlag(scrollState, false);
}
}
/**
* @param {?} config

@@ -331,15 +356,18 @@ * @return {?}

function createScroller(config) {
var /** @type {?} */ containerElement = resolveContainerElement(config.scrollContainer, config.scrollWindow, config.element, config.fromRoot);
var scrollContainer = config.scrollContainer, scrollWindow = config.scrollWindow, element = config.element, fromRoot = config.fromRoot;
var /** @type {?} */ resolver = createResolver({
axis: new AxisResolver(!config.horizontal),
isWindow: isElementWindow(containerElement),
windowElement: containerElement
windowElement: resolveContainerElement(scrollContainer, scrollWindow, element, fromRoot)
});
var /** @type {?} */ scrollPosition = {
last: 0
var /** @type {?} */ stats = calculatePoints(element, resolver);
var /** @type {?} */ scrollState = {
lastScrollPosition: 0,
lastTotalToScroll: 0,
totalToScroll: stats.totalToScroll,
isTriggeredTotal: false
};
var /** @type {?} */ options = {
container: resolver.container,
mergeMap: function () { return calculatePoints(config.element, resolver); },
scrollHandler: function (positionStats) { return handleOnScroll(scrollPosition, positionStats, config); },
mergeMap: function () { return calculatePoints(element, resolver); },
scrollHandler: function (positionStats) { return handleOnScroll(scrollState, positionStats, config); },
throttleDuration: config.throttle

@@ -350,3 +378,13 @@ };

/**
* @param {?} scrollPosition
* @param {?} options
* @return {?}
*/
function attachScrollEvent(options) {
return rxjs_Observable.Observable.fromEvent(options.container, 'scroll')
.sampleTime(options.throttleDuration)
.mergeMap(function (ev) { return rxjs_Observable.Observable.of(options.mergeMap(ev)); })
.subscribe(options.scrollHandler);
}
/**
* @param {?} scrollState
* @param {?} positionStats

@@ -356,3 +394,3 @@ * @param {?} config

*/
function handleOnScroll(scrollPosition, positionStats, config) {
function handleOnScroll(scrollState, positionStats, config) {
var /** @type {?} */ distance = {

@@ -362,12 +400,11 @@ down: config.downDistance,

};
var _a = getScrollStats(scrollPosition.last, positionStats, {
distance: distance
}), isScrollingDown = _a.isScrollingDown, shouldScroll$$1 = _a.shouldScroll;
var _a = getScrollStats(scrollState.lastScrollPosition, positionStats, { distance: distance }), isScrollingDown = _a.isScrollingDown, shouldFireScrollEvent$$1 = _a.shouldFireScrollEvent;
var /** @type {?} */ scrollConfig = {
alwaysCallback: config.alwaysCallback,
disable: config.disable,
shouldScroll: shouldScroll$$1
shouldFireScrollEvent: shouldFireScrollEvent$$1
};
updateScrollPosition(positionStats.scrolledUntilNow, scrollPosition);
if (shouldTriggerEvents(scrollConfig)) {
updateScrollState(scrollState, positionStats.scrolledUntilNow, positionStats.totalToScroll);
var /** @type {?} */ shouldTrigger = shouldTriggerEvents(scrollConfig);
if (shouldTrigger && !scrollState.isTriggeredTotal) {
updateTriggeredFlag(scrollState, true);
triggerEvents(config.events, isScrollingDown, positionStats.scrolledUntilNow);

@@ -374,0 +411,0 @@ }

@@ -1,2 +0,2 @@

!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("rxjs/add/observable/fromEvent"),require("rxjs/add/observable/of"),require("rxjs/add/operator/filter"),require("rxjs/add/operator/mergeMap"),require("rxjs/add/operator/sampleTime"),require("rxjs/Observable")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/add/observable/fromEvent","rxjs/add/observable/of","rxjs/add/operator/filter","rxjs/add/operator/mergeMap","rxjs/add/operator/sampleTime","rxjs/Observable"],factory):factory((global.ng=global.ng||{},global.ng.ngxInfiniteScroll=global.ng.ngxInfiniteScroll||{}),global.ng.core,null,null,null,null,null,global.Rx)}(this,function(exports,_angular_core,rxjs_add_observable_fromEvent,rxjs_add_observable_of,rxjs_add_operator_filter,rxjs_add_operator_mergeMap,rxjs_add_operator_sampleTime,rxjs_Observable){"use strict";function resolveContainerElement(selector,scrollWindow,defaultElement,fromRoot){var hasWindow=window&&!!window.document&&window.document.documentElement,container=hasWindow&&scrollWindow?window:defaultElement;if(selector){if(!(container=selector&&hasWindow&&"string"==typeof selector?findElement(selector,defaultElement.nativeElement,fromRoot):selector))throw new Error("ngx-infinite-scroll {resolveContainerElement()}: selector for")}return container}function findElement(selector,customRoot,fromRoot){return(fromRoot?window.document:customRoot).querySelector(selector)}function inputPropChanged(prop){return prop&&!prop.firstChange}function hasWindowDefined(){return"undefined"!=typeof window}function shouldTriggerEvents(_a){var alwaysCallback=_a.alwaysCallback,shouldScroll=_a.shouldScroll,disable=_a.disable;return(alwaysCallback||shouldScroll)&&!disable}function triggerEvents(callbacks,isScrollingDown,scrolledUntilNow){var eventData={currentScrollPosition:scrolledUntilNow};(isScrollingDown?callbacks.down:callbacks.up)(eventData)}function createResolver(_a){var isWindow=_a.isWindow,windowElement=_a.windowElement;return createResolverWithContainer({axis:_a.axis,isWindow:isWindow},windowElement)}function createResolverWithContainer(resolver,windowElement){var container=resolver.isWindow||windowElement&&!windowElement.nativeElement?windowElement:windowElement.nativeElement;return Object.assign({},resolver,{container:container})}function isElementWindow(windowElement){return["Window","global"].some(function(obj){return Object.prototype.toString.call(windowElement).includes(obj)})}function getDocumentElement(isContainerWindow,windowElement){return isContainerWindow?windowElement.document.documentElement:null}function calculatePoints(element,resolver){var height=extractHeightForElement(resolver);return resolver.isWindow?calculatePointsForWindow(height,element,resolver):calculatePointsForElement(height,element,resolver)}function calculatePointsForWindow(height,element,resolver){var axis=resolver.axis,container=resolver.container,isWindow=resolver.isWindow,_a=extractHeightPropKeys(axis),offsetHeightKey=_a.offsetHeightKey,clientHeightKey=_a.clientHeightKey,scrolledUntilNow=height+getElementPageYOffset(getDocumentElement(isWindow,container),axis,isWindow),nativeElementHeight=getElementHeight(element.nativeElement,isWindow,offsetHeightKey,clientHeightKey);return{height:height,scrolledUntilNow:scrolledUntilNow,totalToScroll:getElementOffsetTop(element.nativeElement,axis,isWindow)+nativeElementHeight}}function calculatePointsForElement(height,element,resolver){var axis=resolver.axis,container=resolver.container;return{height:height,scrolledUntilNow:container[axis.scrollTopKey()],totalToScroll:container[axis.scrollHeightKey()]}}function extractHeightPropKeys(axis){return{offsetHeightKey:axis.offsetHeightKey(),clientHeightKey:axis.clientHeightKey()}}function extractHeightForElement(_a){var container=_a.container,isWindow=_a.isWindow,axis=_a.axis,_b=extractHeightPropKeys(axis);return getElementHeight(container,isWindow,_b.offsetHeightKey,_b.clientHeightKey)}function getElementHeight(elem,isWindow,offsetHeightKey,clientHeightKey){return isNaN(elem[offsetHeightKey])?getDocumentElement(isWindow,elem)[clientHeightKey]:elem[offsetHeightKey]}function getElementOffsetTop(elem,axis,isWindow){var topKey=axis.topKey();if(elem.getBoundingClientRect)return elem.getBoundingClientRect()[topKey]+getElementPageYOffset(elem,axis,isWindow)}function getElementPageYOffset(elem,axis,isWindow){var pageYOffset=axis.pageYOffsetKey(),scrollTop=axis.scrollTopKey(),offsetTop=axis.offsetTopKey();return isNaN(window[pageYOffset])?getDocumentElement(isWindow,elem)[scrollTop]:elem.ownerDocument?elem.ownerDocument.defaultView[pageYOffset]:elem[offsetTop]}function shouldScroll(container,config,scrollingDown){var remaining,containerBreakpoint,distance=config.distance;return scrollingDown?(remaining=container.totalToScroll-container.scrolledUntilNow,containerBreakpoint=container.height*distance.down+1):(remaining=container.scrolledUntilNow,containerBreakpoint=container.height*distance.up+1),remaining<=containerBreakpoint}function isScrollingDownwards(lastScrollPosition,container){return lastScrollPosition<container.scrolledUntilNow}function getScrollStats(lastScrollPosition,container,config){var isScrollingDown=isScrollingDownwards(lastScrollPosition,container);return{shouldScroll:shouldScroll(container,config,isScrollingDown),isScrollingDown:isScrollingDown}}function updateScrollPosition(position,lastPositionState){return lastPositionState.last=position}function attachScrollEvent(options){return rxjs_Observable.Observable.fromEvent(options.container,"scroll").sampleTime(options.throttleDuration).mergeMap(function(ev){return rxjs_Observable.Observable.of(options.mergeMap(ev))}).subscribe(options.scrollHandler)}function createScroller(config){var containerElement=resolveContainerElement(config.scrollContainer,config.scrollWindow,config.element,config.fromRoot),resolver=createResolver({axis:new AxisResolver(!config.horizontal),isWindow:isElementWindow(containerElement),windowElement:containerElement}),scrollPosition={last:0};return attachScrollEvent({container:resolver.container,mergeMap:function(){return calculatePoints(config.element,resolver)},scrollHandler:function(positionStats){return handleOnScroll(scrollPosition,positionStats,config)},throttleDuration:config.throttle})}function handleOnScroll(scrollPosition,positionStats,config){var distance={down:config.downDistance,up:config.upDistance},_a=getScrollStats(scrollPosition.last,positionStats,{distance:distance}),isScrollingDown=_a.isScrollingDown,shouldScroll$$1=_a.shouldScroll,scrollConfig={alwaysCallback:config.alwaysCallback,disable:config.disable,shouldScroll:shouldScroll$$1};updateScrollPosition(positionStats.scrolledUntilNow,scrollPosition),shouldTriggerEvents(scrollConfig)&&triggerEvents(config.events,isScrollingDown,positionStats.scrolledUntilNow)}var AxisResolver=function(){function AxisResolver(vertical){void 0===vertical&&(vertical=!0),this.vertical=vertical}return AxisResolver.prototype.clientHeightKey=function(){return this.vertical?"clientHeight":"clientWidth"},AxisResolver.prototype.offsetHeightKey=function(){return this.vertical?"offsetHeight":"offsetWidth"},AxisResolver.prototype.scrollHeightKey=function(){return this.vertical?"scrollHeight":"scrollWidth"},AxisResolver.prototype.pageYOffsetKey=function(){return this.vertical?"pageYOffset":"pageXOffset"},AxisResolver.prototype.offsetTopKey=function(){return this.vertical?"offsetTop":"offsetLeft"},AxisResolver.prototype.scrollTopKey=function(){return this.vertical?"scrollTop":"scrollLeft"},AxisResolver.prototype.topKey=function(){return this.vertical?"top":"left"},AxisResolver}(),InfiniteScrollDirective=function(){function InfiniteScrollDirective(element,zone){this.element=element,this.zone=zone,this.scrolled=new _angular_core.EventEmitter,this.scrolledUp=new _angular_core.EventEmitter,this.infiniteScrollDistance=2,this.infiniteScrollUpDistance=1.5,this.infiniteScrollThrottle=300,this.infiniteScrollDisabled=!1,this.infiniteScrollContainer=null,this.scrollWindow=!0,this.immediateCheck=!1,this.horizontal=!1,this.alwaysCallback=!1,this.fromRoot=!1}return InfiniteScrollDirective.prototype.ngAfterViewInit=function(){this.infiniteScrollDisabled||this.setup()},InfiniteScrollDirective.prototype.ngOnChanges=function(_a){var infiniteScrollContainer=_a.infiniteScrollContainer,infiniteScrollDisabled=_a.infiniteScrollDisabled,infiniteScrollDistance=_a.infiniteScrollDistance,containerChanged=inputPropChanged(infiniteScrollContainer),disabledChanged=inputPropChanged(infiniteScrollDisabled),distanceChanged=inputPropChanged(infiniteScrollDistance),shouldSetup=!disabledChanged&&!this.infiniteScrollDisabled||disabledChanged&&!infiniteScrollDisabled.currentValue||distanceChanged;(containerChanged||disabledChanged||distanceChanged)&&(this.destroyScroller(),shouldSetup&&this.setup())},InfiniteScrollDirective.prototype.setup=function(){var _this=this;hasWindowDefined()&&this.zone.runOutsideAngular(function(){_this.disposeScroller=createScroller({fromRoot:_this.fromRoot,alwaysCallback:_this.alwaysCallback,disable:_this.infiniteScrollDisabled,downDistance:_this.infiniteScrollDistance,element:_this.element,events:{down:function(event){return _this.zone.run(function(){return _this.scrolled.emit(event)})},up:function(event){return _this.zone.run(function(){return _this.scrolledUp.emit(event)})}},horizontal:_this.horizontal,scrollContainer:_this.infiniteScrollContainer,scrollWindow:_this.scrollWindow,throttle:_this.infiniteScrollThrottle,upDistance:_this.infiniteScrollUpDistance})})},InfiniteScrollDirective.prototype.ngOnDestroy=function(){this.destroyScroller()},InfiniteScrollDirective.prototype.destroyScroller=function(){this.disposeScroller&&this.disposeScroller.unsubscribe()},InfiniteScrollDirective}();InfiniteScrollDirective.decorators=[{type:_angular_core.Directive,args:[{selector:"[infiniteScroll], [infinite-scroll], [data-infinite-scroll]"}]}],InfiniteScrollDirective.ctorParameters=function(){return[{type:_angular_core.ElementRef},{type:_angular_core.NgZone}]},InfiniteScrollDirective.propDecorators={scrolled:[{type:_angular_core.Output}],scrolledUp:[{type:_angular_core.Output}],infiniteScrollDistance:[{type:_angular_core.Input}],infiniteScrollUpDistance:[{type:_angular_core.Input}],infiniteScrollThrottle:[{type:_angular_core.Input}],infiniteScrollDisabled:[{type:_angular_core.Input}],infiniteScrollContainer:[{type:_angular_core.Input}],scrollWindow:[{type:_angular_core.Input}],immediateCheck:[{type:_angular_core.Input}],horizontal:[{type:_angular_core.Input}],alwaysCallback:[{type:_angular_core.Input}],fromRoot:[{type:_angular_core.Input}]};var InfiniteScrollModule=function(){function InfiniteScrollModule(){}return InfiniteScrollModule}();InfiniteScrollModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[InfiniteScrollDirective],exports:[InfiniteScrollDirective],imports:[],providers:[]}]}],InfiniteScrollModule.ctorParameters=function(){return[]},exports.InfiniteScrollDirective=InfiniteScrollDirective,exports.InfiniteScrollModule=InfiniteScrollModule,Object.defineProperty(exports,"__esModule",{value:!0})});
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("rxjs/add/observable/fromEvent"),require("rxjs/add/observable/of"),require("rxjs/add/operator/filter"),require("rxjs/add/operator/mergeMap"),require("rxjs/add/operator/sampleTime"),require("rxjs/Observable")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/add/observable/fromEvent","rxjs/add/observable/of","rxjs/add/operator/filter","rxjs/add/operator/mergeMap","rxjs/add/operator/sampleTime","rxjs/Observable"],factory):factory((global.ng=global.ng||{},global.ng.ngxInfiniteScroll=global.ng.ngxInfiniteScroll||{}),global.ng.core,null,null,null,null,null,global.Rx)}(this,function(exports,_angular_core,rxjs_add_observable_fromEvent,rxjs_add_observable_of,rxjs_add_operator_filter,rxjs_add_operator_mergeMap,rxjs_add_operator_sampleTime,rxjs_Observable){"use strict";function resolveContainerElement(selector,scrollWindow,defaultElement,fromRoot){var hasWindow=window&&!!window.document&&window.document.documentElement,container=hasWindow&&scrollWindow?window:defaultElement;if(selector){if(!(container=selector&&hasWindow&&"string"==typeof selector?findElement(selector,defaultElement.nativeElement,fromRoot):selector))throw new Error("ngx-infinite-scroll {resolveContainerElement()}: selector for")}return container}function findElement(selector,customRoot,fromRoot){return(fromRoot?window.document:customRoot).querySelector(selector)}function inputPropChanged(prop){return prop&&!prop.firstChange}function hasWindowDefined(){return"undefined"!=typeof window}function shouldTriggerEvents(_a){var alwaysCallback=_a.alwaysCallback,shouldFireScrollEvent=_a.shouldFireScrollEvent;return alwaysCallback||shouldFireScrollEvent}function triggerEvents(callbacks,isScrollingDown,scrolledUntilNow){var eventData={currentScrollPosition:scrolledUntilNow};(isScrollingDown?callbacks.down:callbacks.up)(eventData)}function createResolver(_a){var windowElement=_a.windowElement;return createResolverWithContainer({axis:_a.axis,isWindow:isElementWindow(windowElement)},windowElement)}function createResolverWithContainer(resolver,windowElement){var container=resolver.isWindow||windowElement&&!windowElement.nativeElement?windowElement:windowElement.nativeElement;return Object.assign({},resolver,{container:container})}function isElementWindow(windowElement){return["Window","global"].some(function(obj){return Object.prototype.toString.call(windowElement).includes(obj)})}function getDocumentElement(isContainerWindow,windowElement){return isContainerWindow?windowElement.document.documentElement:null}function calculatePoints(element,resolver){var height=extractHeightForElement(resolver);return resolver.isWindow?calculatePointsForWindow(height,element,resolver):calculatePointsForElement(height,element,resolver)}function calculatePointsForWindow(height,element,resolver){var axis=resolver.axis,container=resolver.container,isWindow=resolver.isWindow,_a=extractHeightPropKeys(axis),offsetHeightKey=_a.offsetHeightKey,clientHeightKey=_a.clientHeightKey,scrolledUntilNow=height+getElementPageYOffset(getDocumentElement(isWindow,container),axis,isWindow),nativeElementHeight=getElementHeight(element.nativeElement,isWindow,offsetHeightKey,clientHeightKey);return{height:height,scrolledUntilNow:scrolledUntilNow,totalToScroll:getElementOffsetTop(element.nativeElement,axis,isWindow)+nativeElementHeight}}function calculatePointsForElement(height,element,resolver){var axis=resolver.axis,container=resolver.container;return{height:height,scrolledUntilNow:container[axis.scrollTopKey()],totalToScroll:container[axis.scrollHeightKey()]}}function extractHeightPropKeys(axis){return{offsetHeightKey:axis.offsetHeightKey(),clientHeightKey:axis.clientHeightKey()}}function extractHeightForElement(_a){var container=_a.container,isWindow=_a.isWindow,axis=_a.axis,_b=extractHeightPropKeys(axis);return getElementHeight(container,isWindow,_b.offsetHeightKey,_b.clientHeightKey)}function getElementHeight(elem,isWindow,offsetHeightKey,clientHeightKey){return isNaN(elem[offsetHeightKey])?getDocumentElement(isWindow,elem)[clientHeightKey]:elem[offsetHeightKey]}function getElementOffsetTop(elem,axis,isWindow){var topKey=axis.topKey();if(elem.getBoundingClientRect)return elem.getBoundingClientRect()[topKey]+getElementPageYOffset(elem,axis,isWindow)}function getElementPageYOffset(elem,axis,isWindow){var pageYOffset=axis.pageYOffsetKey(),scrollTop=axis.scrollTopKey(),offsetTop=axis.offsetTopKey();return isNaN(window[pageYOffset])?getDocumentElement(isWindow,elem)[scrollTop]:elem.ownerDocument?elem.ownerDocument.defaultView[pageYOffset]:elem[offsetTop]}function shouldFireScrollEvent(container,config,scrollingDown){var remaining,containerBreakpoint,distance=config.distance;return scrollingDown?(remaining=(container.totalToScroll-container.scrolledUntilNow)/container.totalToScroll,containerBreakpoint=distance.down/10):(remaining=container.scrolledUntilNow/container.totalToScroll,containerBreakpoint=distance.up/10),remaining<=containerBreakpoint}function isScrollingDownwards(lastScrollPosition,container){return lastScrollPosition<container.scrolledUntilNow}function getScrollStats(lastScrollPosition,container,config){var isScrollingDown=isScrollingDownwards(lastScrollPosition,container);return{shouldFireScrollEvent:shouldFireScrollEvent(container,config,isScrollingDown),isScrollingDown:isScrollingDown}}function updateScrollPosition(position,scrollState){return scrollState.lastScrollPosition=position}function updateTotalToScroll(totalToScroll,scrollState){scrollState.lastTotalToScroll=scrollState.totalToScroll,scrollState.totalToScroll=totalToScroll}function isSameTotalToScroll(scrollState){return scrollState.totalToScroll===scrollState.lastTotalToScroll}function updateTriggeredFlag(scrollState,triggered){scrollState.isTriggeredTotal=triggered}function updateScrollState(scrollState,scrolledUntilNow,totalToScroll){updateScrollPosition(scrolledUntilNow,scrollState),updateTotalToScroll(totalToScroll,scrollState),isSameTotalToScroll(scrollState)||updateTriggeredFlag(scrollState,!1)}function createScroller(config){var scrollContainer=config.scrollContainer,scrollWindow=config.scrollWindow,element=config.element,fromRoot=config.fromRoot,resolver=createResolver({axis:new AxisResolver(!config.horizontal),windowElement:resolveContainerElement(scrollContainer,scrollWindow,element,fromRoot)}),stats=calculatePoints(element,resolver),scrollState={lastScrollPosition:0,lastTotalToScroll:0,totalToScroll:stats.totalToScroll,isTriggeredTotal:!1};return attachScrollEvent({container:resolver.container,mergeMap:function(){return calculatePoints(element,resolver)},scrollHandler:function(positionStats){return handleOnScroll(scrollState,positionStats,config)},throttleDuration:config.throttle})}function attachScrollEvent(options){return rxjs_Observable.Observable.fromEvent(options.container,"scroll").sampleTime(options.throttleDuration).mergeMap(function(ev){return rxjs_Observable.Observable.of(options.mergeMap(ev))}).subscribe(options.scrollHandler)}function handleOnScroll(scrollState,positionStats,config){var distance={down:config.downDistance,up:config.upDistance},_a=getScrollStats(scrollState.lastScrollPosition,positionStats,{distance:distance}),isScrollingDown=_a.isScrollingDown,shouldFireScrollEvent$$1=_a.shouldFireScrollEvent,scrollConfig={alwaysCallback:config.alwaysCallback,shouldFireScrollEvent:shouldFireScrollEvent$$1};updateScrollState(scrollState,positionStats.scrolledUntilNow,positionStats.totalToScroll),shouldTriggerEvents(scrollConfig)&&!scrollState.isTriggeredTotal&&(updateTriggeredFlag(scrollState,!0),triggerEvents(config.events,isScrollingDown,positionStats.scrolledUntilNow))}var AxisResolver=function(){function AxisResolver(vertical){void 0===vertical&&(vertical=!0),this.vertical=vertical}return AxisResolver.prototype.clientHeightKey=function(){return this.vertical?"clientHeight":"clientWidth"},AxisResolver.prototype.offsetHeightKey=function(){return this.vertical?"offsetHeight":"offsetWidth"},AxisResolver.prototype.scrollHeightKey=function(){return this.vertical?"scrollHeight":"scrollWidth"},AxisResolver.prototype.pageYOffsetKey=function(){return this.vertical?"pageYOffset":"pageXOffset"},AxisResolver.prototype.offsetTopKey=function(){return this.vertical?"offsetTop":"offsetLeft"},AxisResolver.prototype.scrollTopKey=function(){return this.vertical?"scrollTop":"scrollLeft"},AxisResolver.prototype.topKey=function(){return this.vertical?"top":"left"},AxisResolver}(),InfiniteScrollDirective=function(){function InfiniteScrollDirective(element,zone){this.element=element,this.zone=zone,this.scrolled=new _angular_core.EventEmitter,this.scrolledUp=new _angular_core.EventEmitter,this.infiniteScrollDistance=2,this.infiniteScrollUpDistance=1.5,this.infiniteScrollThrottle=300,this.infiniteScrollDisabled=!1,this.infiniteScrollContainer=null,this.scrollWindow=!0,this.immediateCheck=!1,this.horizontal=!1,this.alwaysCallback=!1,this.fromRoot=!1}return InfiniteScrollDirective.prototype.ngAfterViewInit=function(){this.infiniteScrollDisabled||this.setup()},InfiniteScrollDirective.prototype.ngOnChanges=function(_a){var infiniteScrollContainer=_a.infiniteScrollContainer,infiniteScrollDisabled=_a.infiniteScrollDisabled,infiniteScrollDistance=_a.infiniteScrollDistance,containerChanged=inputPropChanged(infiniteScrollContainer),disabledChanged=inputPropChanged(infiniteScrollDisabled),distanceChanged=inputPropChanged(infiniteScrollDistance),shouldSetup=!disabledChanged&&!this.infiniteScrollDisabled||disabledChanged&&!infiniteScrollDisabled.currentValue||distanceChanged;(containerChanged||disabledChanged||distanceChanged)&&(this.destroyScroller(),shouldSetup&&this.setup())},InfiniteScrollDirective.prototype.setup=function(){var _this=this;hasWindowDefined()&&this.zone.runOutsideAngular(function(){_this.disposeScroller=createScroller({fromRoot:_this.fromRoot,alwaysCallback:_this.alwaysCallback,disable:_this.infiniteScrollDisabled,downDistance:_this.infiniteScrollDistance,element:_this.element,events:{down:function(event){return _this.zone.run(function(){return _this.scrolled.emit(event)})},up:function(event){return _this.zone.run(function(){return _this.scrolledUp.emit(event)})}},horizontal:_this.horizontal,scrollContainer:_this.infiniteScrollContainer,scrollWindow:_this.scrollWindow,throttle:_this.infiniteScrollThrottle,upDistance:_this.infiniteScrollUpDistance})})},InfiniteScrollDirective.prototype.ngOnDestroy=function(){this.destroyScroller()},InfiniteScrollDirective.prototype.destroyScroller=function(){this.disposeScroller&&this.disposeScroller.unsubscribe()},InfiniteScrollDirective}();InfiniteScrollDirective.decorators=[{type:_angular_core.Directive,args:[{selector:"[infiniteScroll], [infinite-scroll], [data-infinite-scroll]"}]}],InfiniteScrollDirective.ctorParameters=function(){return[{type:_angular_core.ElementRef},{type:_angular_core.NgZone}]},InfiniteScrollDirective.propDecorators={scrolled:[{type:_angular_core.Output}],scrolledUp:[{type:_angular_core.Output}],infiniteScrollDistance:[{type:_angular_core.Input}],infiniteScrollUpDistance:[{type:_angular_core.Input}],infiniteScrollThrottle:[{type:_angular_core.Input}],infiniteScrollDisabled:[{type:_angular_core.Input}],infiniteScrollContainer:[{type:_angular_core.Input}],scrollWindow:[{type:_angular_core.Input}],immediateCheck:[{type:_angular_core.Input}],horizontal:[{type:_angular_core.Input}],alwaysCallback:[{type:_angular_core.Input}],fromRoot:[{type:_angular_core.Input}]};var InfiniteScrollModule=function(){function InfiniteScrollModule(){}return InfiniteScrollModule}();InfiniteScrollModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[InfiniteScrollDirective],exports:[InfiniteScrollDirective],imports:[],providers:[]}]}],InfiniteScrollModule.ctorParameters=function(){return[]},exports.InfiniteScrollDirective=InfiniteScrollDirective,exports.InfiniteScrollModule=InfiniteScrollModule,Object.defineProperty(exports,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-infinite-scroll.umd.min.js.map

@@ -95,4 +95,4 @@ import { Directive, ElementRef, EventEmitter, Input, NgModule, NgZone, Output } from '@angular/core';

function shouldTriggerEvents(_a) {
var alwaysCallback = _a.alwaysCallback, shouldScroll = _a.shouldScroll, disable = _a.disable;
return (alwaysCallback || shouldScroll) && !disable;
var alwaysCallback = _a.alwaysCallback, shouldFireScrollEvent = _a.shouldFireScrollEvent;
return (alwaysCallback || shouldFireScrollEvent);
}

@@ -117,7 +117,4 @@ /**

function createResolver(_a) {
var isWindow = _a.isWindow, windowElement = _a.windowElement, axis = _a.axis;
return createResolverWithContainer({
axis: axis,
isWindow: isWindow
}, windowElement);
var windowElement = _a.windowElement, axis = _a.axis;
return createResolverWithContainer({ axis: axis, isWindow: isElementWindow(windowElement) }, windowElement);
}

@@ -269,3 +266,3 @@ /**

*/
function shouldScroll(container, config, scrollingDown) {
function shouldFireScrollEvent(container, config, scrollingDown) {
var /** @type {?} */ distance = config.distance;

@@ -275,11 +272,11 @@ var /** @type {?} */ remaining;

if (scrollingDown) {
remaining = container.totalToScroll - container.scrolledUntilNow;
containerBreakpoint = container.height * distance.down + 1;
remaining = (container.totalToScroll - container.scrolledUntilNow) / container.totalToScroll;
containerBreakpoint = distance.down / 10;
}
else {
remaining = container.scrolledUntilNow;
containerBreakpoint = container.height * distance.up + 1;
remaining = container.scrolledUntilNow / container.totalToScroll;
containerBreakpoint = distance.up / 10;
}
var /** @type {?} */ shouldScroll = remaining <= containerBreakpoint;
return shouldScroll;
var /** @type {?} */ shouldFireEvent = remaining <= containerBreakpoint;
return shouldFireEvent;
}

@@ -303,3 +300,3 @@ /**

return {
shouldScroll: shouldScroll(container, config, isScrollingDown),
shouldFireScrollEvent: shouldFireScrollEvent(container, config, isScrollingDown),
isScrollingDown: isScrollingDown

@@ -310,19 +307,47 @@ };

* @param {?} position
* @param {?} lastPositionState
* @param {?} scrollState
* @return {?}
*/
function updateScrollPosition(position, lastPositionState) {
return (lastPositionState.last = position);
function updateScrollPosition(position, scrollState) {
return (scrollState.lastScrollPosition = position);
}
/**
* @param {?} options
* @param {?} totalToScroll
* @param {?} scrollState
* @return {?}
*/
function attachScrollEvent(options) {
return Observable.fromEvent(options.container, 'scroll')
.sampleTime(options.throttleDuration)
.mergeMap(function (ev) { return Observable.of(options.mergeMap(ev)); })
.subscribe(options.scrollHandler);
function updateTotalToScroll(totalToScroll, scrollState) {
scrollState.lastTotalToScroll = scrollState.totalToScroll;
scrollState.totalToScroll = totalToScroll;
}
/**
* @param {?} scrollState
* @return {?}
*/
function isSameTotalToScroll(scrollState) {
return scrollState.totalToScroll === scrollState.lastTotalToScroll;
}
/**
* @param {?} scrollState
* @param {?} triggered
* @return {?}
*/
function updateTriggeredFlag(scrollState, triggered) {
scrollState.isTriggeredTotal = triggered;
}
/**
* @param {?} scrollState
* @param {?} scrolledUntilNow
* @param {?} totalToScroll
* @return {?}
*/
function updateScrollState(scrollState, scrolledUntilNow, totalToScroll) {
updateScrollPosition(scrolledUntilNow, scrollState);
updateTotalToScroll(totalToScroll, scrollState);
var /** @type {?} */ isSameTotal = isSameTotalToScroll(scrollState);
if (!isSameTotal) {
updateTriggeredFlag(scrollState, false);
}
}
/**
* @param {?} config

@@ -332,15 +357,18 @@ * @return {?}

function createScroller(config) {
var /** @type {?} */ containerElement = resolveContainerElement(config.scrollContainer, config.scrollWindow, config.element, config.fromRoot);
var scrollContainer = config.scrollContainer, scrollWindow = config.scrollWindow, element = config.element, fromRoot = config.fromRoot;
var /** @type {?} */ resolver = createResolver({
axis: new AxisResolver(!config.horizontal),
isWindow: isElementWindow(containerElement),
windowElement: containerElement
windowElement: resolveContainerElement(scrollContainer, scrollWindow, element, fromRoot)
});
var /** @type {?} */ scrollPosition = {
last: 0
var /** @type {?} */ stats = calculatePoints(element, resolver);
var /** @type {?} */ scrollState = {
lastScrollPosition: 0,
lastTotalToScroll: 0,
totalToScroll: stats.totalToScroll,
isTriggeredTotal: false
};
var /** @type {?} */ options = {
container: resolver.container,
mergeMap: function () { return calculatePoints(config.element, resolver); },
scrollHandler: function (positionStats) { return handleOnScroll(scrollPosition, positionStats, config); },
mergeMap: function () { return calculatePoints(element, resolver); },
scrollHandler: function (positionStats) { return handleOnScroll(scrollState, positionStats, config); },
throttleDuration: config.throttle

@@ -351,3 +379,13 @@ };

/**
* @param {?} scrollPosition
* @param {?} options
* @return {?}
*/
function attachScrollEvent(options) {
return Observable.fromEvent(options.container, 'scroll')
.sampleTime(options.throttleDuration)
.mergeMap(function (ev) { return Observable.of(options.mergeMap(ev)); })
.subscribe(options.scrollHandler);
}
/**
* @param {?} scrollState
* @param {?} positionStats

@@ -357,3 +395,3 @@ * @param {?} config

*/
function handleOnScroll(scrollPosition, positionStats, config) {
function handleOnScroll(scrollState, positionStats, config) {
var /** @type {?} */ distance = {

@@ -363,12 +401,11 @@ down: config.downDistance,

};
var _a = getScrollStats(scrollPosition.last, positionStats, {
distance: distance
}), isScrollingDown = _a.isScrollingDown, shouldScroll$$1 = _a.shouldScroll;
var _a = getScrollStats(scrollState.lastScrollPosition, positionStats, { distance: distance }), isScrollingDown = _a.isScrollingDown, shouldFireScrollEvent$$1 = _a.shouldFireScrollEvent;
var /** @type {?} */ scrollConfig = {
alwaysCallback: config.alwaysCallback,
disable: config.disable,
shouldScroll: shouldScroll$$1
shouldFireScrollEvent: shouldFireScrollEvent$$1
};
updateScrollPosition(positionStats.scrolledUntilNow, scrollPosition);
if (shouldTriggerEvents(scrollConfig)) {
updateScrollState(scrollState, positionStats.scrolledUntilNow, positionStats.totalToScroll);
var /** @type {?} */ shouldTrigger = shouldTriggerEvents(scrollConfig);
if (shouldTrigger && !scrollState.isTriggeredTotal) {
updateTriggeredFlag(scrollState, true);
triggerEvents(config.events, isScrollingDown, positionStats.scrolledUntilNow);

@@ -375,0 +412,0 @@ }

@@ -95,4 +95,4 @@ import { Directive, ElementRef, EventEmitter, Input, NgModule, NgZone, Output } from '@angular/core';

*/
function shouldTriggerEvents({ alwaysCallback, shouldScroll, disable }) {
return (alwaysCallback || shouldScroll) && !disable;
function shouldTriggerEvents({ alwaysCallback, shouldFireScrollEvent }) {
return (alwaysCallback || shouldFireScrollEvent);
}

@@ -117,7 +117,4 @@ /**

*/
function createResolver({ isWindow, windowElement, axis }) {
return createResolverWithContainer({
axis,
isWindow
}, windowElement);
function createResolver({ windowElement, axis }) {
return createResolverWithContainer({ axis, isWindow: isElementWindow(windowElement) }, windowElement);
}

@@ -269,3 +266,3 @@ /**

*/
function shouldScroll(container, config, scrollingDown) {
function shouldFireScrollEvent(container, config, scrollingDown) {
const /** @type {?} */ distance = config.distance;

@@ -275,11 +272,11 @@ let /** @type {?} */ remaining;

if (scrollingDown) {
remaining = container.totalToScroll - container.scrolledUntilNow;
containerBreakpoint = container.height * distance.down + 1;
remaining = (container.totalToScroll - container.scrolledUntilNow) / container.totalToScroll;
containerBreakpoint = distance.down / 10;
}
else {
remaining = container.scrolledUntilNow;
containerBreakpoint = container.height * distance.up + 1;
remaining = container.scrolledUntilNow / container.totalToScroll;
containerBreakpoint = distance.up / 10;
}
const /** @type {?} */ shouldScroll = remaining <= containerBreakpoint;
return shouldScroll;
const /** @type {?} */ shouldFireEvent = remaining <= containerBreakpoint;
return shouldFireEvent;
}

@@ -303,3 +300,3 @@ /**

return {
shouldScroll: shouldScroll(container, config, isScrollingDown),
shouldFireScrollEvent: shouldFireScrollEvent(container, config, isScrollingDown),
isScrollingDown

@@ -310,20 +307,48 @@ };

* @param {?} position
* @param {?} lastPositionState
* @param {?} scrollState
* @return {?}
*/
function updateScrollPosition(position, lastPositionState) {
return (lastPositionState.last = position);
function updateScrollPosition(position, scrollState) {
return (scrollState.lastScrollPosition = position);
}
/**
* @param {?} options
* @param {?} totalToScroll
* @param {?} scrollState
* @return {?}
*/
function attachScrollEvent(options) {
return Observable.fromEvent(options.container, 'scroll')
.sampleTime(options.throttleDuration)
.mergeMap((ev) => Observable.of(options.mergeMap(ev)))
.subscribe(options.scrollHandler);
function updateTotalToScroll(totalToScroll, scrollState) {
scrollState.lastTotalToScroll = scrollState.totalToScroll;
scrollState.totalToScroll = totalToScroll;
}
/**
* @param {?} scrollState
* @return {?}
*/
function isSameTotalToScroll(scrollState) {
return scrollState.totalToScroll === scrollState.lastTotalToScroll;
}
/**
* @param {?} scrollState
* @param {?} triggered
* @return {?}
*/
function updateTriggeredFlag(scrollState, triggered) {
scrollState.isTriggeredTotal = triggered;
}
/**
* @param {?} scrollState
* @param {?} scrolledUntilNow
* @param {?} totalToScroll
* @return {?}
*/
function updateScrollState(scrollState, scrolledUntilNow, totalToScroll) {
updateScrollPosition(scrolledUntilNow, scrollState);
updateTotalToScroll(totalToScroll, scrollState);
const /** @type {?} */ isSameTotal = isSameTotalToScroll(scrollState);
if (!isSameTotal) {
updateTriggeredFlag(scrollState, false);
}
}
/**
* @param {?} config

@@ -333,15 +358,18 @@ * @return {?}

function createScroller(config) {
const /** @type {?} */ containerElement = resolveContainerElement(config.scrollContainer, config.scrollWindow, config.element, config.fromRoot);
const { scrollContainer, scrollWindow, element, fromRoot } = config;
const /** @type {?} */ resolver = createResolver({
axis: new AxisResolver(!config.horizontal),
isWindow: isElementWindow(containerElement),
windowElement: containerElement
windowElement: resolveContainerElement(scrollContainer, scrollWindow, element, fromRoot)
});
const /** @type {?} */ scrollPosition = {
last: 0
const /** @type {?} */ stats = calculatePoints(element, resolver);
const /** @type {?} */ scrollState = {
lastScrollPosition: 0,
lastTotalToScroll: 0,
totalToScroll: stats.totalToScroll,
isTriggeredTotal: false
};
const /** @type {?} */ options = {
container: resolver.container,
mergeMap: () => calculatePoints(config.element, resolver),
scrollHandler: (positionStats) => handleOnScroll(scrollPosition, positionStats, config),
mergeMap: () => calculatePoints(element, resolver),
scrollHandler: (positionStats) => handleOnScroll(scrollState, positionStats, config),
throttleDuration: config.throttle

@@ -352,3 +380,13 @@ };

/**
* @param {?} scrollPosition
* @param {?} options
* @return {?}
*/
function attachScrollEvent(options) {
return Observable.fromEvent(options.container, 'scroll')
.sampleTime(options.throttleDuration)
.mergeMap((ev) => Observable.of(options.mergeMap(ev)))
.subscribe(options.scrollHandler);
}
/**
* @param {?} scrollState
* @param {?} positionStats

@@ -358,3 +396,3 @@ * @param {?} config

*/
function handleOnScroll(scrollPosition, positionStats, config) {
function handleOnScroll(scrollState, positionStats, config) {
const /** @type {?} */ distance = {

@@ -364,12 +402,11 @@ down: config.downDistance,

};
const { isScrollingDown, shouldScroll: shouldScroll$$1 } = getScrollStats(scrollPosition.last, positionStats, {
distance
});
const { isScrollingDown, shouldFireScrollEvent: shouldFireScrollEvent$$1 } = getScrollStats(scrollState.lastScrollPosition, positionStats, { distance });
const /** @type {?} */ scrollConfig = {
alwaysCallback: config.alwaysCallback,
disable: config.disable,
shouldScroll: shouldScroll$$1
shouldFireScrollEvent: shouldFireScrollEvent$$1
};
updateScrollPosition(positionStats.scrolledUntilNow, scrollPosition);
if (shouldTriggerEvents(scrollConfig)) {
updateScrollState(scrollState, positionStats.scrolledUntilNow, positionStats.totalToScroll);
const /** @type {?} */ shouldTrigger = shouldTriggerEvents(scrollConfig);
if (shouldTrigger && !scrollState.isTriggeredTotal) {
updateTriggeredFlag(scrollState, true);
triggerEvents(config.events, isScrollingDown, positionStats.scrolledUntilNow);

@@ -376,0 +413,0 @@ }

{
"name": "ngx-infinite-scroll",
"version": "0.7.2",
"version": "0.8.0",
"description": "An infinite scroll directive for Angular compatible with AoT compilation and Tree shaking",

@@ -5,0 +5,0 @@ "main": "./bundles/ngx-infinite-scroll.umd.js",

@@ -25,3 +25,4 @@ [![Build Status](https://travis-ci.org/orizens/ngx-infinite-scroll.svg?branch=master)](https://travis-ci.org/orizens/ngx-infinite-scroll)

Currently supported attributes:
* **infiniteScrollDistance**<_number_> - (optional, default: **2**) - should get a number, the number of viewport lengths from the bottom of the page at which the event will be triggered.
* **infiniteScrollDistance**<_number_> - (optional, default: **2**) - the bottom percentage point of the scroll nob relatively to the infinite-scroll container (i.e, 2 (2 * 10 = 20%) is event is triggered when 80% (100% - 20%) has been scrolled).
if container.height is 900px, when the container is scrolled to or past the 720px, it will fire the scrolled event.
* **infiniteScrollUpDistance**<_number_> - (optional, default: **1.5**) - should get a number

@@ -28,0 +29,0 @@ * **infiniteScrollThrottle**<_number_> - (optional, default: **300**) - should get a number of **milliseconds** for throttle. The event will be triggered this many milliseconds after the user *stops* scrolling.

@@ -9,3 +9,2 @@ import { ElementRef } from '@angular/core';

axis: any;
isWindow: boolean;
}

@@ -28,2 +27,8 @@ export interface IPositionStats {

}
export interface IScrollState {
lastTotalToScroll: number;
totalToScroll: number;
isTriggeredTotal: boolean;
lastScrollPosition: number;
}
export interface IResolver {

@@ -30,0 +35,0 @@ container: ContainerRef;

@@ -19,6 +19,5 @@ import { IPositionStats } from '../models';

alwaysCallback: boolean;
disable: boolean;
shouldScroll: boolean;
shouldFireScrollEvent: boolean;
}
export declare function shouldTriggerEvents({alwaysCallback, shouldScroll, disable}: IScrollConfig): boolean;
export declare function shouldTriggerEvents({alwaysCallback, shouldFireScrollEvent}: IScrollConfig): boolean;
export declare function triggerEvents(callbacks: ITriggerEvents, isScrollingDown: boolean, scrolledUntilNow: number): void;
import { ElementRef } from '@angular/core';
import { ContainerRef, IPositionElements, IPositionStats, IResolver } from '../models';
import { AxisResolver } from './axis-resolver';
export declare function createResolver({isWindow, windowElement, axis}: IPositionElements): IResolver;
export declare function createResolver({windowElement, axis}: IPositionElements): IResolver;
export declare function createResolverWithContainer(resolver: any, windowElement: ContainerRef): any;

@@ -6,0 +6,0 @@ export declare function isElementWindow(windowElement: ContainerRef): boolean;

@@ -8,3 +8,3 @@ import 'rxjs/add/observable/fromEvent';

import { Subscription } from 'rxjs/Subscription';
import { ContainerRef, IPositionStats } from '../models';
import { ContainerRef, IPositionStats, IScrollState } from '../models';
export interface IScrollRegisterConfig {

@@ -32,4 +32,4 @@ container: ContainerRef;

}
export declare function createScroller(config: IScroller): Subscription;
export declare function attachScrollEvent(options: IScrollRegisterConfig): Subscription;
export declare function createScroller(config: IScroller): Subscription;
export declare function handleOnScroll(scrollPosition: any, positionStats: IPositionStats, config: IScroller): void;
export declare function handleOnScroll(scrollState: IScrollState, positionStats: IPositionStats, config: IScroller): void;

@@ -1,8 +0,12 @@

import { IPositionStats, IScrollerConfig } from '../models';
export declare function shouldScroll(container: IPositionStats, config: IScrollerConfig, scrollingDown: boolean): boolean;
import { IPositionStats, IScrollerConfig, IScrollState } from '../models';
export declare function shouldFireScrollEvent(container: IPositionStats, config: IScrollerConfig, scrollingDown: boolean): boolean;
export declare function isScrollingDownwards(lastScrollPosition: number, container: IPositionStats): boolean;
export declare function getScrollStats(lastScrollPosition: number, container: IPositionStats, config: IScrollerConfig): {
shouldScroll: boolean;
shouldFireScrollEvent: boolean;
isScrollingDown: boolean;
};
export declare function updateScrollPosition(position: number, lastPositionState: any): number;
export declare function updateScrollPosition(position: number, scrollState: IScrollState): number;
export declare function updateTotalToScroll(totalToScroll: number, scrollState: IScrollState): void;
export declare function isSameTotalToScroll(scrollState: any): boolean;
export declare function updateTriggeredFlag(scrollState: any, triggered: boolean): void;
export declare function updateScrollState(scrollState: IScrollState, scrolledUntilNow: number, totalToScroll: number): void;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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