diff --git a/src/app/components/console/console.component.ts b/src/app/components/console/console.component.ts index 7444914..debfd54 100644 --- a/src/app/components/console/console.component.ts +++ b/src/app/components/console/console.component.ts @@ -3,13 +3,13 @@ import {sleep} from '../../misc/utils'; import {TypewriterComponent} from '../typewriter/typewriter.component'; @Component({ - selector: 'console', - templateUrl: './console.component.html', + selector: 'console', + templateUrl: './console.component.html', styleUrls: ['./console.component.scss'] }) export class ConsoleComponent { done = () => {}; - input = ''; + input = ''; output: string[] = []; prompt = '>' @@ -20,13 +20,16 @@ export class ConsoleComponent { clear() { this.output = []; } exec(input: string, output: () => any, pause = 1000) { - this.done = async () => { - await sleep(pause); - this.input = ''; - this.output.push(`${this.prompt} ${input}`); - const out = output(); - if(typeof out == 'string') this.output.push(out); - }; - this.input = input; + return new Promise(res => { + this.done = async () => { + await sleep(pause); + this.input = ''; + this.output.push(`${this.prompt} ${input}`); + const out = output(); + if(typeof out == 'string') this.output.push(out); + res(); + }; + this.input = input; + }); } } diff --git a/src/app/services/quote.service.ts b/src/app/services/quote.service.ts index 6232de6..b2533c5 100644 --- a/src/app/services/quote.service.ts +++ b/src/app/services/quote.service.ts @@ -7,7 +7,13 @@ export class QuoteService { 'Some one at Google was like "Yea, just have someone drive down every road on earth!"', 'Anxiety is like when video game combat music is playing but you can\'t find the enemy', 'Why do kamikaze pilots wear helmets?', - 'The cake is a lie!' + 'The cake is a lie!', + 'How are unicorns fake but giraffes real?', + 'The number of people older than you never goes up', + 'When you brush your teeth you are cleaning your skeleton', + 'Pregenancy is like a group project where one person get\'s stuck with all the work', + 'If the universe wasn\'t inifinate it would be even scarier', + 'Either we are alone in the universe or we are not. both are terrifying' ]; random() { diff --git a/src/app/views/home/home.component.ts b/src/app/views/home/home.component.ts index 3970ab4..3afd7f1 100644 --- a/src/app/views/home/home.component.ts +++ b/src/app/views/home/home.component.ts @@ -4,8 +4,8 @@ import {QuoteService} from '../../services/quote.service'; import {sleep} from '../../misc/utils'; @Component({ - selector: 'home', - templateUrl: './home.component.html' + selector: 'home', + templateUrl: './home.component.html' }) export class HomeComponent implements AfterViewInit { @ViewChild(ConsoleComponent) console!: ConsoleComponent; @@ -16,12 +16,10 @@ export class HomeComponent implements AfterViewInit { animateConsole() { setTimeout(async () => { - this.console.exec('bash ./random-thought.sh', () => this.quotes.random()); + await this.console.exec('bash ./random-thought.sh', () => this.quotes.random()); await sleep(10000); - this.console.exec('clear', async () => { - this.console.clear(); - this.animateConsole(); - }); + await this.console.exec('clear', async () => this.console.clear()); + this.animateConsole(); }, 1000); } }