Skip to content

Commit

Permalink
simplified some initializers
Browse files Browse the repository at this point in the history
force angular to detect style changes by introducing a 0 ms timeout in setPrintLockTo
remove unused references
  • Loading branch information
Bdegraaf1234 committed Sep 18, 2023
1 parent 179040e commit 260b93d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
8 changes: 3 additions & 5 deletions src/main/webapp/app/layouts/main/main.component.ts
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { Component, OnInit} from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';

import { JhiLanguageHelper } from '../../shared';
import {PrintService} from "../../shared/util/print.service";
Expand All @@ -19,14 +18,13 @@ export class JhiMainComponent implements OnInit {
) {
}

public isPrintLocked$: Observable<boolean>;
isPrintLocked$= this.printService.isPrintLocked$;

ngOnInit() {
this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
this.jhiLanguageHelper.updateTitle();
}
});
this.isPrintLocked$ = this.printService.isPrintLocked$;
}
}
@@ -1,4 +1,4 @@
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { Component, Inject, OnDestroy, OnInit} from '@angular/core';
import { DatePipe, DOCUMENT } from '@angular/common';
import { HttpResponse } from '@angular/common/http';
import { ActivatedRoute, Params } from '@angular/router';
Expand Down
11 changes: 4 additions & 7 deletions src/main/webapp/app/shared/util/print.service.ts
Expand Up @@ -4,14 +4,11 @@ import { BehaviorSubject } from "rxjs";
@Injectable({ providedIn: 'root' })
export class PrintService {

public isPrintLocked$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);

constructor(
) {
this.isPrintLocked$.subscribe();
}
isPrintLocked$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);

setPrintLockTo(setTo: boolean) {
this.isPrintLocked$.next(setTo)
setTimeout(() => {
this.isPrintLocked$.next(setTo)
});
}
}

0 comments on commit 260b93d

Please sign in to comment.