UNPKG

2.05 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("primeng/defer",["exports","@angular/core","@angular/common"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.defer={}),e.ng.core,e.ng.common)}(this,(function(e,t,o){"use strict";var n=this&&this.__decorate||function(e,t,o,n){var r,i=arguments.length,d=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,t,o,n);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(d=(i<3?r(d):i>3?r(t,o,d):r(t,o))||d);return i>3&&d&&Object.defineProperty(t,o,d),d},r=function(){function e(e,o,n){this.el=e,this.renderer=o,this.viewContainer=n,this.onLoad=new t.EventEmitter}return e.prototype.ngAfterViewInit=function(){var e=this;this.shouldLoad()&&this.load(),this.isLoaded()||(this.documentScrollListener=this.renderer.listen("window","scroll",(function(){e.shouldLoad()&&(e.load(),e.documentScrollListener(),e.documentScrollListener=null)})))},e.prototype.shouldLoad=function(){if(this.isLoaded())return!1;var e=this.el.nativeElement.getBoundingClientRect();return document.documentElement.clientHeight>=e.top},e.prototype.load=function(){this.view=this.viewContainer.createEmbeddedView(this.template),this.onLoad.emit()},e.prototype.isLoaded=function(){return null!=this.view},e.prototype.ngOnDestroy=function(){this.view=null,this.documentScrollListener&&this.documentScrollListener()},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2},{type:t.ViewContainerRef}]},n([t.Output()],e.prototype,"onLoad",void 0),n([t.ContentChild(t.TemplateRef)],e.prototype,"template",void 0),e=n([t.Directive({selector:"[pDefer]"})],e)}(),i=function(){function e(){}return e=n([t.NgModule({imports:[o.CommonModule],exports:[r],declarations:[r]})],e)}();e.DeferModule=i,e.DeferredLoader=r,Object.defineProperty(e,"__esModule",{value:!0})}));
2//# sourceMappingURL=primeng-defer.umd.min.js.map
\No newline at end of file