Skip to content

Commit

Permalink
Fix Promise with useDefineForClassFields #10706
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Oct 3, 2024
1 parent c8cfbd5 commit 3ea2d79
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export class NaturalGalleryComponent<T extends ModelAttributes = ModelAttributes

@ViewChild('gallery', {static: true}) private galleryElement!: ElementRef<HTMLElement>;

public readonly gallery = new Promise<Natural<T>>(resolve => {
this.resolve = resolve;
});
public readonly gallery: Promise<Natural<T>>;

private resolve!: (value: Natural<T>) => void;

Expand All @@ -32,6 +30,12 @@ export class NaturalGalleryComponent<T extends ModelAttributes = ModelAttributes
this.gallery.then(gallery => gallery.setItems(items));
}

public constructor() {
this.gallery = new Promise<Natural<T>>(resolve => {
this.resolve = resolve;
});
}

public ngOnInit(): void {
setTimeout(() => {
const gallery = new Natural<T>(this.galleryElement.nativeElement, this.options, this.scrollable);
Expand Down

0 comments on commit 3ea2d79

Please sign in to comment.