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

@trademe/ng-defer-load

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trademe/ng-defer-load - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0-alpha.1

4

dist/defer-load.directive.d.ts

@@ -5,6 +5,8 @@ import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnDestroy } from '@angular/core';

private _zone;
private platformId;
preRender: boolean;
deferLoad: EventEmitter<any>;
private _intersectionObserver?;
private _scrollSubscription?;
constructor(_element: ElementRef, _zone: NgZone);
constructor(_element: ElementRef, _zone: NgZone, platformId: Object);
ngAfterViewInit(): void;

@@ -11,0 +13,0 @@ hasCompatibleBrowser(): boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var common_1 = require("@angular/common");
var core_1 = require("@angular/core");

@@ -8,6 +9,8 @@ var fromEvent_1 = require("rxjs/observable/fromEvent");

var DeferLoadDirective = /** @class */ (function () {
function DeferLoadDirective(_element, _zone) {
function DeferLoadDirective(_element, _zone, platformId) {
var _this = this;
this._element = _element;
this._zone = _zone;
this.platformId = platformId;
this.preRender = true;
this.deferLoad = new core_1.EventEmitter();

@@ -31,11 +34,17 @@ this.checkForIntersection = function (entries) {

DeferLoadDirective.prototype.ngAfterViewInit = function () {
if (this.hasCompatibleBrowser()) {
this.registerIntersectionObserver();
if (this._intersectionObserver) {
this._intersectionObserver.observe((this._element.nativeElement));
if (common_1.isPlatformBrowser(this.platformId)) {
if (this.hasCompatibleBrowser()) {
this.registerIntersectionObserver();
if (this._intersectionObserver && this._element.nativeElement) {
this._intersectionObserver.observe((this._element.nativeElement));
}
}
else {
this.addScrollListeners();
}
}
else {
// add scroll watch if intersection observer is not available
this.addScrollListeners();
if (this.preRender) {
this.load();
}
}

@@ -106,2 +115,6 @@ };

tslib_1.__decorate([
core_1.Input(),
tslib_1.__metadata("design:type", Boolean)
], DeferLoadDirective.prototype, "preRender", void 0);
tslib_1.__decorate([
core_1.Output(),

@@ -114,4 +127,6 @@ tslib_1.__metadata("design:type", core_1.EventEmitter)

}),
tslib_1.__param(2, core_1.Inject(core_1.PLATFORM_ID)),
tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
core_1.NgZone])
core_1.NgZone,
Object])
], DeferLoadDirective);

@@ -118,0 +133,0 @@ return DeferLoadDirective;

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

[{"__symbolic":"module","version":4,"metadata":{"DeferLoadDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"[deferLoad]"}]}],"members":{"deferLoad":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":10,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":16,"character":26},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":17,"character":23}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"hasCompatibleBrowser":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"registerIntersectionObserver":[{"__symbolic":"method"}],"checkIfIntersecting":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}],"addScrollListeners":[{"__symbolic":"method"}],"removeListeners":[{"__symbolic":"method"}],"isVisible":[{"__symbolic":"method"}],"getScrollPosition":[{"__symbolic":"method"}]}}}}]
[{"__symbolic":"module","version":4,"metadata":{"DeferLoadDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":6,"character":1},"arguments":[{"selector":"[deferLoad]"}]}],"members":{"preRender":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":5}}]}],"deferLoad":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":12,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":9},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":20,"character":16}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":18,"character":26},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":19,"character":23},{"__symbolic":"reference","name":"Object"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"hasCompatibleBrowser":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"registerIntersectionObserver":[{"__symbolic":"method"}],"checkIfIntersecting":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}],"addScrollListeners":[{"__symbolic":"method"}],"removeListeners":[{"__symbolic":"method"}],"isVisible":[{"__symbolic":"method"}],"getScrollPosition":[{"__symbolic":"method"}]}}}}]
{
"name": "@trademe/ng-defer-load",
"version": "1.0.1",
"version": "1.1.0-alpha.1",
"description": "Angular directive to load elements lazily",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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