Skip to content

Commit

Permalink
14.0.1 - use es6 import
Browse files Browse the repository at this point in the history
  • Loading branch information
Yongnan Wu committed Oct 28, 2022
1 parent badf06f commit ac0fba0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## 14.0.1

- Use ES6 import for CJS module

## 14.0.0

- Angular 14 update and Ivy build
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-masonry",
"version": "14.0.0",
"version": "14.0.1",
"description": "Angular Module for displaying a feed of items in a masonry layout using https://github.com/desandro/masonry",
"keywords": [
"angular",
Expand Down
10 changes: 2 additions & 8 deletions src/lib/ngx-masonry.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { isPlatformBrowser } from '@angular/common';
import { Component, ElementRef, EventEmitter, Inject, Input, OnChanges, OnDestroy, OnInit, Output, PLATFORM_ID, SimpleChanges } from '@angular/core';
import { NgxMasonryOptions } from './ngx-masonry-options';
import { NgxMasonryDirective } from './ngx-masonry.directive';

declare var require: any;
let masonryConstructor: any;
import Masonry from 'masonry-layout';

@Component({
selector: '[ngx-masonry], ngx-masonry',
Expand Down Expand Up @@ -36,10 +34,6 @@ export class NgxMasonryComponent implements OnInit, OnChanges, OnDestroy {

ngOnInit() {

if (isPlatformBrowser(this.platformId) && masonryConstructor === undefined) {
masonryConstructor = require('masonry-layout');
}

// Create masonry options object
if (!this.options) {
this.options = {};
Expand All @@ -54,7 +48,7 @@ export class NgxMasonryComponent implements OnInit, OnChanges, OnDestroy {

if (isPlatformBrowser(this.platformId)) {
// Initialize Masonry
this.masonryInstance = new masonryConstructor(this._element.nativeElement, this.options);
this.masonryInstance = new Masonry(this._element.nativeElement, this.options);

// Bind to events
this.masonryInstance.on('layoutComplete', (items: any) => {
Expand Down

0 comments on commit ac0fba0

Please sign in to comment.