Skip to content

Commit 7a31dd2

Browse files
committed
2 parents aa18afe + 6e62e49 commit 7a31dd2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/components/logo/logo.component.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
import { Component, OnInit } from '@angular/core';
2+
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
23
import { concat, Observable, timer } from 'rxjs';
34
import { delay, finalize, map, repeat, startWith, takeWhile, tap } from 'rxjs/operators';
45

6+
@UntilDestroy()
57
@Component({
68
selector: 't-logo',
79
templateUrl: './logo.component.html',
810
styleUrls: ['./logo.component.scss']
911
})
1012
export class LogoComponent implements OnInit {
1113
className: string = '';
12-
constructor() {}
14+
15+
constructor() {
16+
}
1317

1418
ngOnInit(): void {
1519
concat(this.run(), this.eyes())
1620
.pipe(
1721
delay(5000),
18-
repeat(1000)
22+
repeat(1000),
23+
untilDestroyed(this)
1924
)
2025
.subscribe();
2126
}
@@ -27,7 +32,7 @@ export class LogoComponent implements OnInit {
2732
takeWhile((x) => x < 6),
2833
tap((x) => {
2934
let state = x % 2 === 0 ? 1 : 2;
30-
this.className = `l${state}`;
35+
this.className = `l${ state }`;
3136
})
3237
);
3338
}
@@ -43,10 +48,10 @@ export class LogoComponent implements OnInit {
4348
side = side === 'r' ? 'l' : 'r';
4449
}
4550
let state = x % 2 === 0 ? 3 : 4;
46-
this.className = `${side}${state}`;
51+
this.className = `${ side }${ state }`;
4752
}),
4853
finalize(() => {
49-
this.className = `${side}1`;
54+
this.className = `${ side }1`;
5055
})
5156
);
5257
}

0 commit comments

Comments
 (0)