Added loop to console (closes #1)

This commit is contained in:
2022-05-03 16:41:55 -04:00
parent f4ff3c3ad7
commit ce0e7dcc98
4 changed files with 48 additions and 20 deletions

View File

@ -1,15 +1,27 @@
import {Component, ViewChild} from '@angular/core';
import {ConsoleComponent, ConsoleConfig} from '../../components/console/console.component';
import {AfterViewInit, Component, ViewChild} from '@angular/core';
import {ConsoleComponent} from '../../components/console/console.component';
import {QuoteService} from '../../services/quote.service';
import {sleep} from '../../misc/utils';
@Component({
selector: 'home',
templateUrl: './home.component.html'
})
export class HomeComponent {
export class HomeComponent implements AfterViewInit {
@ViewChild(ConsoleComponent) console!: ConsoleComponent;
constructor(private quotes: QuoteService) {
setTimeout(() => this.console.exec('bash ./random-thought.sh', () => quotes.random()), 3000);
constructor(private quotes: QuoteService) { }
ngAfterViewInit() { this.animateConsole(); }
animateConsole() {
setTimeout(async () => {
this.console.exec('bash ./random-thought.sh', () => this.quotes.random());
await sleep(10000);
this.console.exec('clear', async () => {
this.console.clear();
this.animateConsole();
});
}, 1000);
}
}