[DURACOM-240] refactor variable

This commit is contained in:
Andrea Barbasso
2024-02-27 10:23:56 +01:00
committed by Giuseppe Digilio
parent e402ac482d
commit e1ba78c443

View File

@@ -16,7 +16,7 @@ import {
}) })
export class ClientMathService extends MathService { export class ClientMathService extends MathService {
protected signal: Subject<boolean>; protected isReady$: Subject<boolean>;
protected mathJaxOptions = { protected mathJaxOptions = {
tex: { tex: {
@@ -42,14 +42,13 @@ export class ClientMathService extends MathService {
constructor() { constructor() {
super(); super();
this.signal = new ReplaySubject<boolean>(1); this.isReady$ = new ReplaySubject<boolean>(1);
void this.registerMathJaxAsync(this.mathJax) void this.registerMathJaxAsync(this.mathJax)
.then(() => this.signal.next(true)) .then(() => this.isReady$.next(true))
.catch(_ => { .catch(_ => {
void this.registerMathJaxAsync(this.mathJaxFallback) void this.registerMathJaxAsync(this.mathJaxFallback)
.then(() => this.signal.next(true)) .then(() => this.isReady$.next(true));
.catch((error) => console.log(error));
}); });
} }
@@ -77,7 +76,7 @@ export class ClientMathService extends MathService {
} }
ready(): Observable<boolean> { ready(): Observable<boolean> {
return this.signal; return this.isReady$;
} }
render(element: HTMLElement) { render(element: HTMLElement) {