Updated console
This commit is contained in:
parent
ce0e7dcc98
commit
cf05d96812
@ -3,13 +3,13 @@ import {sleep} from '../../misc/utils';
|
|||||||
import {TypewriterComponent} from '../typewriter/typewriter.component';
|
import {TypewriterComponent} from '../typewriter/typewriter.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'console',
|
selector: 'console',
|
||||||
templateUrl: './console.component.html',
|
templateUrl: './console.component.html',
|
||||||
styleUrls: ['./console.component.scss']
|
styleUrls: ['./console.component.scss']
|
||||||
})
|
})
|
||||||
export class ConsoleComponent {
|
export class ConsoleComponent {
|
||||||
done = () => {};
|
done = () => {};
|
||||||
input = '';
|
input = '';
|
||||||
output: string[] = [];
|
output: string[] = [];
|
||||||
prompt = '>'
|
prompt = '>'
|
||||||
|
|
||||||
@ -20,13 +20,16 @@ export class ConsoleComponent {
|
|||||||
clear() { this.output = []; }
|
clear() { this.output = []; }
|
||||||
|
|
||||||
exec(input: string, output: () => any, pause = 1000) {
|
exec(input: string, output: () => any, pause = 1000) {
|
||||||
this.done = async () => {
|
return new Promise<void>(res => {
|
||||||
await sleep(pause);
|
this.done = async () => {
|
||||||
this.input = '';
|
await sleep(pause);
|
||||||
this.output.push(`${this.prompt} ${input}`);
|
this.input = '';
|
||||||
const out = output();
|
this.output.push(`${this.prompt} ${input}`);
|
||||||
if(typeof out == 'string') this.output.push(out);
|
const out = output();
|
||||||
};
|
if(typeof out == 'string') this.output.push(out);
|
||||||
this.input = input;
|
res();
|
||||||
|
};
|
||||||
|
this.input = input;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,13 @@ export class QuoteService {
|
|||||||
'Some one at Google was like "Yea, just have someone drive down every road on earth!"',
|
'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',
|
'Anxiety is like when video game combat music is playing but you can\'t find the enemy',
|
||||||
'Why do kamikaze pilots wear helmets?',
|
'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() {
|
random() {
|
||||||
|
@ -4,8 +4,8 @@ import {QuoteService} from '../../services/quote.service';
|
|||||||
import {sleep} from '../../misc/utils';
|
import {sleep} from '../../misc/utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'home',
|
selector: 'home',
|
||||||
templateUrl: './home.component.html'
|
templateUrl: './home.component.html'
|
||||||
})
|
})
|
||||||
export class HomeComponent implements AfterViewInit {
|
export class HomeComponent implements AfterViewInit {
|
||||||
@ViewChild(ConsoleComponent) console!: ConsoleComponent;
|
@ViewChild(ConsoleComponent) console!: ConsoleComponent;
|
||||||
@ -16,12 +16,10 @@ export class HomeComponent implements AfterViewInit {
|
|||||||
|
|
||||||
animateConsole() {
|
animateConsole() {
|
||||||
setTimeout(async () => {
|
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);
|
await sleep(10000);
|
||||||
this.console.exec('clear', async () => {
|
await this.console.exec('clear', async () => this.console.clear());
|
||||||
this.console.clear();
|
this.animateConsole();
|
||||||
this.animateConsole();
|
|
||||||
});
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user