ngx-infinite-scroll
Advanced tools
Comparing version 0.4.2 to 0.4.3-0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/Observable'), require('rxjs/add/observable/fromEvent'), require('rxjs/add/observable/timer'), require('rxjs/add/observable/of'), require('rxjs/add/operator/debounce'), require('rxjs/add/operator/throttle'), require('rxjs/add/operator/filter'), require('rxjs/add/operator/mergeMap')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs/Observable', 'rxjs/add/observable/fromEvent', 'rxjs/add/observable/timer', 'rxjs/add/observable/of', 'rxjs/add/operator/debounce', 'rxjs/add/operator/throttle', 'rxjs/add/operator/filter', 'rxjs/add/operator/mergeMap'], factory) : | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/Observable'), 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')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'rxjs/Observable', 'rxjs/add/observable/fromEvent', 'rxjs/add/observable/of', 'rxjs/add/operator/filter', 'rxjs/add/operator/mergeMap', 'rxjs/add/operator/sampleTime'], factory) : | ||
(factory((global.ng = global.ng || {}, global.ng.ngxInfiniteScroll = global.ng.ngxInfiniteScroll || {}),global.ng.core,global.Rx)); | ||
@@ -228,3 +228,4 @@ }(this, (function (exports,_angular_core,rxjs_Observable) { 'use strict'; | ||
ScrollRegister.prototype.attachEvent = function (options) { | ||
var /** @type {?} */ scroller$ = rxjs_Observable.Observable.fromEvent(options.container, 'scroll')[options.throttleType](function () { return rxjs_Observable.Observable.timer(options.throttleDuration); }) | ||
var /** @type {?} */ scroller$ = rxjs_Observable.Observable.fromEvent(options.container, 'scroll') | ||
.sampleTime(options.throttleDuration) | ||
.filter(options.filterBefore) | ||
@@ -231,0 +232,0 @@ .mergeMap(function (ev) { return rxjs_Observable.Observable.of(options.mergeMap(ev)); }) |
@@ -1,2 +0,2 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("rxjs/Observable"),require("rxjs/add/observable/fromEvent"),require("rxjs/add/observable/timer"),require("rxjs/add/observable/of"),require("rxjs/add/operator/debounce"),require("rxjs/add/operator/throttle"),require("rxjs/add/operator/filter"),require("rxjs/add/operator/mergeMap")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/Observable","rxjs/add/observable/fromEvent","rxjs/add/observable/timer","rxjs/add/observable/of","rxjs/add/operator/debounce","rxjs/add/operator/throttle","rxjs/add/operator/filter","rxjs/add/operator/mergeMap"],factory):factory((global.ng=global.ng||{},global.ng.ngxInfiniteScroll=global.ng.ngxInfiniteScroll||{}),global.ng.core,global.Rx)}(this,function(exports,_angular_core,rxjs_Observable){"use strict";var AxisResolverFactory=function(){function AxisResolverFactory(){}return AxisResolverFactory.prototype.create=function(vertical){return void 0===vertical&&(vertical=!0),new AxisResolver(vertical)},AxisResolverFactory}();AxisResolverFactory.decorators=[{type:_angular_core.Injectable}],AxisResolverFactory.ctorParameters=function(){return[]};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}(),PositionResolverFactory=function(){function PositionResolverFactory(axisResolver){this.axisResolver=axisResolver}return PositionResolverFactory.prototype.create=function(options){return new PositionResolver(this.axisResolver.create(!options.horizontal),options)},PositionResolverFactory}();PositionResolverFactory.decorators=[{type:_angular_core.Injectable}],PositionResolverFactory.ctorParameters=function(){return[{type:AxisResolverFactory}]};var PositionResolver=function(){function PositionResolver(axis,options){this.axis=axis,this.options=options,this.resolveContainer(this.options.windowElement),this.defineContainer(this.options.windowElement)}return PositionResolver.prototype.defineContainer=function(windowElement){return this.resolveContainer(windowElement)||!windowElement.nativeElement?this.container=windowElement:this.container=windowElement.nativeElement,this.container},PositionResolver.prototype.resolveContainer=function(windowElement){var isContainerWindow=Object.prototype.toString.call(windowElement).includes("Window");return this.isContainerWindow=isContainerWindow,isContainerWindow},PositionResolver.prototype.getDocumentElement=function(){return this.isContainerWindow?this.options.windowElement.document.documentElement:null},PositionResolver.prototype.calculatePoints=function(element){return this.isContainerWindow?this.calculatePointsForWindow(element):this.calculatePointsForElement(element)},PositionResolver.prototype.calculatePointsForWindow=function(element){var height=this.height(this.container);return{height:height,scrolledUntilNow:height+this.pageYOffset(this.getDocumentElement()),totalToScroll:this.offsetTop(element.nativeElement)+this.height(element.nativeElement)}},PositionResolver.prototype.calculatePointsForElement=function(element){var scrollTop=this.axis.scrollTopKey(),scrollHeight=this.axis.scrollHeightKey(),container=this.container,height=this.height(container),scrolledUntilNow=container[scrollTop],offsetTop=this.offsetTop(container);return void 0!==offsetTop&&offsetTop,{height:height,scrolledUntilNow:scrolledUntilNow,totalToScroll:container[scrollHeight]}},PositionResolver.prototype.height=function(elem){var offsetHeight=this.axis.offsetHeightKey(),clientHeight=this.axis.clientHeightKey();return isNaN(elem[offsetHeight])?this.getDocumentElement()[clientHeight]:elem[offsetHeight]},PositionResolver.prototype.offsetTop=function(elem){var top=this.axis.topKey();if(elem.getBoundingClientRect)return elem.getBoundingClientRect()[top]+this.pageYOffset(elem)},PositionResolver.prototype.pageYOffset=function(elem){var pageYOffset=this.axis.pageYOffsetKey(),scrollTop=this.axis.scrollTopKey(),offsetTop=this.axis.offsetTopKey();return isNaN(window[pageYOffset])?this.getDocumentElement()[scrollTop]:elem.ownerDocument?elem.ownerDocument.defaultView[pageYOffset]:elem[offsetTop]},PositionResolver}(),ScrollRegister=function(){function ScrollRegister(){}return ScrollRegister.prototype.attachEvent=function(options){return rxjs_Observable.Observable.fromEvent(options.container,"scroll")[options.throttleType](function(){return rxjs_Observable.Observable.timer(options.throttleDuration)}).filter(options.filterBefore).mergeMap(function(ev){return rxjs_Observable.Observable.of(options.mergeMap(ev))}).subscribe(options.scrollHandler)},ScrollRegister}();ScrollRegister.decorators=[{type:_angular_core.Injectable}],ScrollRegister.ctorParameters=function(){return[]};var ScrollResolver=function(){function ScrollResolver(){this.lastScrollPosition=0}return ScrollResolver.prototype.shouldScroll=function(container,config,scrollingDown){var remaining,containerBreakpoint,distance=config.distance;scrollingDown?(remaining=container.totalToScroll-container.scrolledUntilNow,containerBreakpoint=container.height*distance.down+1):(remaining=container.scrolledUntilNow,containerBreakpoint=container.height*distance.up+1);var shouldScroll=remaining<=containerBreakpoint;return this.lastScrollPosition=container.scrolledUntilNow,shouldScroll},ScrollResolver.prototype.isScrollingDown=function(container){return this.lastScrollPosition<container.scrolledUntilNow},ScrollResolver.prototype.getScrollStats=function(container,config){var isScrollingDown=this.isScrollingDown(container);return{isScrollingDown:isScrollingDown,shouldScroll:this.shouldScroll(container,config,isScrollingDown)}},ScrollResolver}();ScrollResolver.decorators=[{type:_angular_core.Injectable}],ScrollResolver.ctorParameters=function(){return[]};var InfiniteScroll=function(){function InfiniteScroll(element,zone,positionResolverFactory,scrollRegister,scrollerResolver){this.element=element,this.zone=zone,this.positionResolverFactory=positionResolverFactory,this.scrollRegister=scrollRegister,this.scrollerResolver=scrollerResolver,this.scrolled=new _angular_core.EventEmitter,this.scrolledUp=new _angular_core.EventEmitter,this._distanceDown=2,this._distanceUp=1.5,this._throttle=300,this._disabled=!1,this._container=null,this.scrollWindow=!0,this._immediate=!1,this._horizontal=!1,this._alwaysCallback=!1,this.throttleType="throttle"}return Object.defineProperty(InfiniteScroll.prototype,"debounce",{set:function(value){this.throttleType=""===value||value?"debounce":"throttle"},enumerable:!0,configurable:!0}),InfiniteScroll.prototype.ngOnInit=function(){var _this=this;if("undefined"!=typeof window){var containerElement=this.resolveContainerElement(),positionResolver_1=this.positionResolverFactory.create({windowElement:containerElement,horizontal:this._horizontal}),options={container:positionResolver_1.container,throttleType:this.throttleType,throttleDuration:this._throttle,filterBefore:function(){return!_this._disabled},mergeMap:function(){return positionResolver_1.calculatePoints(_this.element)},scrollHandler:function(container){return _this.handleOnScroll(container)}};this.disposeScroller=this.scrollRegister.attachEvent(options)}},InfiniteScroll.prototype.handleOnScroll=function(container){var scrollResolverConfig={distance:{down:this._distanceDown,up:this._distanceUp}},scrollStats=this.scrollerResolver.getScrollStats(container,scrollResolverConfig);if(this.shouldTriggerEvents(scrollStats.shouldScroll)){var infiniteScrollEvent={currentScrollPosition:container.scrolledUntilNow};scrollStats.isScrollingDown?this.onScrollDown(infiniteScrollEvent):this.onScrollUp(infiniteScrollEvent)}},InfiniteScroll.prototype.shouldTriggerEvents=function(shouldScroll){return(this._alwaysCallback||shouldScroll)&&!this._disabled},InfiniteScroll.prototype.ngOnDestroy=function(){this.disposeScroller&&this.disposeScroller.unsubscribe()},InfiniteScroll.prototype.onScrollDown=function(data){var _this=this;void 0===data&&(data={currentScrollPosition:0}),this.zone.run(function(){return _this.scrolled.emit(data)})},InfiniteScroll.prototype.onScrollUp=function(data){var _this=this;void 0===data&&(data={currentScrollPosition:0}),this.zone.run(function(){return _this.scrolledUp.emit(data)})},InfiniteScroll.prototype.resolveContainerElement=function(){return this._container?"string"==typeof this._container?window.document.querySelector(this._container):this._container:this.scrollWindow?window:this.element},InfiniteScroll}();InfiniteScroll.decorators=[{type:_angular_core.Directive,args:[{selector:"[infiniteScroll],[infinite-scroll]"}]}],InfiniteScroll.ctorParameters=function(){return[{type:_angular_core.ElementRef},{type:_angular_core.NgZone},{type:PositionResolverFactory},{type:ScrollRegister},{type:ScrollResolver}]},InfiniteScroll.propDecorators={scrolled:[{type:_angular_core.Output}],scrolledUp:[{type:_angular_core.Output}],_distanceDown:[{type:_angular_core.Input,args:["infiniteScrollDistance"]}],_distanceUp:[{type:_angular_core.Input,args:["infiniteScrollUpDistance"]}],_throttle:[{type:_angular_core.Input,args:["infiniteScrollThrottle"]}],_disabled:[{type:_angular_core.Input,args:["infiniteScrollDisabled"]}],_container:[{type:_angular_core.Input,args:["infiniteScrollContainer"]}],scrollWindow:[{type:_angular_core.Input,args:["scrollWindow"]}],_immediate:[{type:_angular_core.Input,args:["immediateCheck"]}],_horizontal:[{type:_angular_core.Input,args:["horizontal"]}],_alwaysCallback:[{type:_angular_core.Input,args:["alwaysCallback"]}],debounce:[{type:_angular_core.Input}]};var InfiniteScrollModule=function(){function InfiniteScrollModule(){}return InfiniteScrollModule}();InfiniteScrollModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[InfiniteScroll],exports:[InfiniteScroll],imports:[],providers:[AxisResolverFactory,PositionResolverFactory,ScrollRegister,ScrollResolver]}]}],InfiniteScrollModule.ctorParameters=function(){return[]},exports.InfiniteScrollModule=InfiniteScrollModule,exports.ɵa=InfiniteScroll,exports.ɵc=AxisResolverFactory,exports.ɵb=PositionResolverFactory,exports.ɵd=ScrollRegister,exports.ɵe=ScrollResolver,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("rxjs/Observable"),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")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/Observable","rxjs/add/observable/fromEvent","rxjs/add/observable/of","rxjs/add/operator/filter","rxjs/add/operator/mergeMap","rxjs/add/operator/sampleTime"],factory):factory((global.ng=global.ng||{},global.ng.ngxInfiniteScroll=global.ng.ngxInfiniteScroll||{}),global.ng.core,global.Rx)}(this,function(exports,_angular_core,rxjs_Observable){"use strict";var AxisResolverFactory=function(){function AxisResolverFactory(){}return AxisResolverFactory.prototype.create=function(vertical){return void 0===vertical&&(vertical=!0),new AxisResolver(vertical)},AxisResolverFactory}();AxisResolverFactory.decorators=[{type:_angular_core.Injectable}],AxisResolverFactory.ctorParameters=function(){return[]};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}(),PositionResolverFactory=function(){function PositionResolverFactory(axisResolver){this.axisResolver=axisResolver}return PositionResolverFactory.prototype.create=function(options){return new PositionResolver(this.axisResolver.create(!options.horizontal),options)},PositionResolverFactory}();PositionResolverFactory.decorators=[{type:_angular_core.Injectable}],PositionResolverFactory.ctorParameters=function(){return[{type:AxisResolverFactory}]};var PositionResolver=function(){function PositionResolver(axis,options){this.axis=axis,this.options=options,this.resolveContainer(this.options.windowElement),this.defineContainer(this.options.windowElement)}return PositionResolver.prototype.defineContainer=function(windowElement){return this.resolveContainer(windowElement)||!windowElement.nativeElement?this.container=windowElement:this.container=windowElement.nativeElement,this.container},PositionResolver.prototype.resolveContainer=function(windowElement){var isContainerWindow=Object.prototype.toString.call(windowElement).includes("Window");return this.isContainerWindow=isContainerWindow,isContainerWindow},PositionResolver.prototype.getDocumentElement=function(){return this.isContainerWindow?this.options.windowElement.document.documentElement:null},PositionResolver.prototype.calculatePoints=function(element){return this.isContainerWindow?this.calculatePointsForWindow(element):this.calculatePointsForElement(element)},PositionResolver.prototype.calculatePointsForWindow=function(element){var height=this.height(this.container);return{height:height,scrolledUntilNow:height+this.pageYOffset(this.getDocumentElement()),totalToScroll:this.offsetTop(element.nativeElement)+this.height(element.nativeElement)}},PositionResolver.prototype.calculatePointsForElement=function(element){var scrollTop=this.axis.scrollTopKey(),scrollHeight=this.axis.scrollHeightKey(),container=this.container,height=this.height(container),scrolledUntilNow=container[scrollTop],offsetTop=this.offsetTop(container);return void 0!==offsetTop&&offsetTop,{height:height,scrolledUntilNow:scrolledUntilNow,totalToScroll:container[scrollHeight]}},PositionResolver.prototype.height=function(elem){var offsetHeight=this.axis.offsetHeightKey(),clientHeight=this.axis.clientHeightKey();return isNaN(elem[offsetHeight])?this.getDocumentElement()[clientHeight]:elem[offsetHeight]},PositionResolver.prototype.offsetTop=function(elem){var top=this.axis.topKey();if(elem.getBoundingClientRect)return elem.getBoundingClientRect()[top]+this.pageYOffset(elem)},PositionResolver.prototype.pageYOffset=function(elem){var pageYOffset=this.axis.pageYOffsetKey(),scrollTop=this.axis.scrollTopKey(),offsetTop=this.axis.offsetTopKey();return isNaN(window[pageYOffset])?this.getDocumentElement()[scrollTop]:elem.ownerDocument?elem.ownerDocument.defaultView[pageYOffset]:elem[offsetTop]},PositionResolver}(),ScrollRegister=function(){function ScrollRegister(){}return ScrollRegister.prototype.attachEvent=function(options){return rxjs_Observable.Observable.fromEvent(options.container,"scroll").sampleTime(options.throttleDuration).filter(options.filterBefore).mergeMap(function(ev){return rxjs_Observable.Observable.of(options.mergeMap(ev))}).subscribe(options.scrollHandler)},ScrollRegister}();ScrollRegister.decorators=[{type:_angular_core.Injectable}],ScrollRegister.ctorParameters=function(){return[]};var ScrollResolver=function(){function ScrollResolver(){this.lastScrollPosition=0}return ScrollResolver.prototype.shouldScroll=function(container,config,scrollingDown){var remaining,containerBreakpoint,distance=config.distance;scrollingDown?(remaining=container.totalToScroll-container.scrolledUntilNow,containerBreakpoint=container.height*distance.down+1):(remaining=container.scrolledUntilNow,containerBreakpoint=container.height*distance.up+1);var shouldScroll=remaining<=containerBreakpoint;return this.lastScrollPosition=container.scrolledUntilNow,shouldScroll},ScrollResolver.prototype.isScrollingDown=function(container){return this.lastScrollPosition<container.scrolledUntilNow},ScrollResolver.prototype.getScrollStats=function(container,config){var isScrollingDown=this.isScrollingDown(container);return{isScrollingDown:isScrollingDown,shouldScroll:this.shouldScroll(container,config,isScrollingDown)}},ScrollResolver}();ScrollResolver.decorators=[{type:_angular_core.Injectable}],ScrollResolver.ctorParameters=function(){return[]};var InfiniteScroll=function(){function InfiniteScroll(element,zone,positionResolverFactory,scrollRegister,scrollerResolver){this.element=element,this.zone=zone,this.positionResolverFactory=positionResolverFactory,this.scrollRegister=scrollRegister,this.scrollerResolver=scrollerResolver,this.scrolled=new _angular_core.EventEmitter,this.scrolledUp=new _angular_core.EventEmitter,this._distanceDown=2,this._distanceUp=1.5,this._throttle=300,this._disabled=!1,this._container=null,this.scrollWindow=!0,this._immediate=!1,this._horizontal=!1,this._alwaysCallback=!1,this.throttleType="throttle"}return Object.defineProperty(InfiniteScroll.prototype,"debounce",{set:function(value){this.throttleType=""===value||value?"debounce":"throttle"},enumerable:!0,configurable:!0}),InfiniteScroll.prototype.ngOnInit=function(){var _this=this;if("undefined"!=typeof window){var containerElement=this.resolveContainerElement(),positionResolver_1=this.positionResolverFactory.create({windowElement:containerElement,horizontal:this._horizontal}),options={container:positionResolver_1.container,throttleType:this.throttleType,throttleDuration:this._throttle,filterBefore:function(){return!_this._disabled},mergeMap:function(){return positionResolver_1.calculatePoints(_this.element)},scrollHandler:function(container){return _this.handleOnScroll(container)}};this.disposeScroller=this.scrollRegister.attachEvent(options)}},InfiniteScroll.prototype.handleOnScroll=function(container){var scrollResolverConfig={distance:{down:this._distanceDown,up:this._distanceUp}},scrollStats=this.scrollerResolver.getScrollStats(container,scrollResolverConfig);if(this.shouldTriggerEvents(scrollStats.shouldScroll)){var infiniteScrollEvent={currentScrollPosition:container.scrolledUntilNow};scrollStats.isScrollingDown?this.onScrollDown(infiniteScrollEvent):this.onScrollUp(infiniteScrollEvent)}},InfiniteScroll.prototype.shouldTriggerEvents=function(shouldScroll){return(this._alwaysCallback||shouldScroll)&&!this._disabled},InfiniteScroll.prototype.ngOnDestroy=function(){this.disposeScroller&&this.disposeScroller.unsubscribe()},InfiniteScroll.prototype.onScrollDown=function(data){var _this=this;void 0===data&&(data={currentScrollPosition:0}),this.zone.run(function(){return _this.scrolled.emit(data)})},InfiniteScroll.prototype.onScrollUp=function(data){var _this=this;void 0===data&&(data={currentScrollPosition:0}),this.zone.run(function(){return _this.scrolledUp.emit(data)})},InfiniteScroll.prototype.resolveContainerElement=function(){return this._container?"string"==typeof this._container?window.document.querySelector(this._container):this._container:this.scrollWindow?window:this.element},InfiniteScroll}();InfiniteScroll.decorators=[{type:_angular_core.Directive,args:[{selector:"[infiniteScroll],[infinite-scroll]"}]}],InfiniteScroll.ctorParameters=function(){return[{type:_angular_core.ElementRef},{type:_angular_core.NgZone},{type:PositionResolverFactory},{type:ScrollRegister},{type:ScrollResolver}]},InfiniteScroll.propDecorators={scrolled:[{type:_angular_core.Output}],scrolledUp:[{type:_angular_core.Output}],_distanceDown:[{type:_angular_core.Input,args:["infiniteScrollDistance"]}],_distanceUp:[{type:_angular_core.Input,args:["infiniteScrollUpDistance"]}],_throttle:[{type:_angular_core.Input,args:["infiniteScrollThrottle"]}],_disabled:[{type:_angular_core.Input,args:["infiniteScrollDisabled"]}],_container:[{type:_angular_core.Input,args:["infiniteScrollContainer"]}],scrollWindow:[{type:_angular_core.Input,args:["scrollWindow"]}],_immediate:[{type:_angular_core.Input,args:["immediateCheck"]}],_horizontal:[{type:_angular_core.Input,args:["horizontal"]}],_alwaysCallback:[{type:_angular_core.Input,args:["alwaysCallback"]}],debounce:[{type:_angular_core.Input}]};var InfiniteScrollModule=function(){function InfiniteScrollModule(){}return InfiniteScrollModule}();InfiniteScrollModule.decorators=[{type:_angular_core.NgModule,args:[{declarations:[InfiniteScroll],exports:[InfiniteScroll],imports:[],providers:[AxisResolverFactory,PositionResolverFactory,ScrollRegister,ScrollResolver]}]}],InfiniteScrollModule.ctorParameters=function(){return[]},exports.InfiniteScrollModule=InfiniteScrollModule,exports.ɵa=InfiniteScroll,exports.ɵc=AxisResolverFactory,exports.ɵb=PositionResolverFactory,exports.ɵd=ScrollRegister,exports.ɵe=ScrollResolver,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-infinite-scroll.umd.min.js.map |
import { Directive, ElementRef, EventEmitter, Injectable, Input, NgModule, NgZone, Output } from '@angular/core'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/fromEvent'; | ||
import 'rxjs/add/observable/timer'; | ||
import 'rxjs/add/observable/of'; | ||
import 'rxjs/add/operator/debounce'; | ||
import 'rxjs/add/operator/throttle'; | ||
import 'rxjs/add/operator/filter'; | ||
import 'rxjs/add/operator/mergeMap'; | ||
import 'rxjs/add/operator/sampleTime'; | ||
var AxisResolverFactory = (function () { | ||
@@ -231,3 +229,4 @@ function AxisResolverFactory() { | ||
ScrollRegister.prototype.attachEvent = function (options) { | ||
var /** @type {?} */ scroller$ = Observable.fromEvent(options.container, 'scroll')[options.throttleType](function () { return Observable.timer(options.throttleDuration); }) | ||
var /** @type {?} */ scroller$ = Observable.fromEvent(options.container, 'scroll') | ||
.sampleTime(options.throttleDuration) | ||
.filter(options.filterBefore) | ||
@@ -234,0 +233,0 @@ .mergeMap(function (ev) { return Observable.of(options.mergeMap(ev)); }) |
import { Directive, ElementRef, EventEmitter, Injectable, Input, NgModule, NgZone, Output } from '@angular/core'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/observable/fromEvent'; | ||
import 'rxjs/add/observable/timer'; | ||
import 'rxjs/add/observable/of'; | ||
import 'rxjs/add/operator/debounce'; | ||
import 'rxjs/add/operator/throttle'; | ||
import 'rxjs/add/operator/filter'; | ||
import 'rxjs/add/operator/mergeMap'; | ||
import 'rxjs/add/operator/sampleTime'; | ||
@@ -225,3 +223,4 @@ class AxisResolverFactory { | ||
attachEvent(options) { | ||
const /** @type {?} */ scroller$ = Observable.fromEvent(options.container, 'scroll')[options.throttleType](() => Observable.timer(options.throttleDuration)) | ||
const /** @type {?} */ scroller$ = Observable.fromEvent(options.container, 'scroll') | ||
.sampleTime(options.throttleDuration) | ||
.filter(options.filterBefore) | ||
@@ -228,0 +227,0 @@ .mergeMap((ev) => Observable.of(options.mergeMap(ev))) |
{ | ||
"name": "ngx-infinite-scroll", | ||
"version": "0.4.2", | ||
"version": "0.4.3-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", |
@@ -7,4 +7,4 @@ [![Build Status](https://travis-ci.org/orizens/ngx-infinite-scroll.svg?branch=master)](https://travis-ci.org/orizens/ngx-infinite-scroll) | ||
## Angular Support | ||
Supports in Angular **> 4** | ||
For Angular (<= 2.3.1), you can use ```npm i angular2-infinite-scroll``` (latest version is 0.3.42) - please notice **the angular2-infinite-scroll** package is deprecated | ||
Supports Angular **> 4** | ||
For Angular version **<= 2.3.1**, you can use ```npm i angular2-infinite-scroll``` (latest version is 0.3.42) - please notice **the angular2-infinite-scroll** package is deprecated | ||
@@ -75,3 +75,3 @@ ## Angular Consulting Services | ||
<div class="search-results" | ||
infinite-scroll | ||
infiniteScroll | ||
[infiniteScrollDistance]="2" | ||
@@ -104,3 +104,3 @@ [infiniteScrollThrottle]="300" | ||
<div class="search-results" | ||
infinite-scroll | ||
infiniteScroll | ||
[infiniteScrollDistance]="2" | ||
@@ -131,3 +131,3 @@ [infiniteScrollThrottle]="500" | ||
<div class="search-results" | ||
infinite-scroll | ||
infiniteScroll | ||
[infiniteScrollDistance]="2" | ||
@@ -153,2 +153,2 @@ [infiniteScrollUpDistance]="1.5" | ||
# Showcase Examples | ||
* [Echoes Player Ng2 Version](http://orizens.github.io/echoes-ng2) ([github repo for echoes player](http://github.com/orizens/echoes-ng2)) | ||
* [Echoes Player - Developed with Angular, angular-cli and ngrx](http://orizens.github.io/echoes-player) ([github repo for echoes player](http://github.com/orizens/echoes-player)) |
import { ContainerRef } from '../models'; | ||
import { Subscription } from 'rxjs/Subscription'; | ||
import 'rxjs/add/observable/fromEvent'; | ||
import 'rxjs/add/observable/timer'; | ||
import 'rxjs/add/observable/of'; | ||
import 'rxjs/add/operator/debounce'; | ||
import 'rxjs/add/operator/throttle'; | ||
import 'rxjs/add/operator/filter'; | ||
import 'rxjs/add/operator/mergeMap'; | ||
import 'rxjs/add/operator/sampleTime'; | ||
export interface ScrollRegisterConfig { | ||
@@ -14,5 +12,5 @@ container: ContainerRef; | ||
throttleDuration: number; | ||
filterBefore: Function; | ||
filterBefore: () => boolean; | ||
mergeMap: Function; | ||
scrollHandler: Function; | ||
scrollHandler: (value: any) => void; | ||
} | ||
@@ -19,0 +17,0 @@ export declare class ScrollRegister { |
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
200087
1645