mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
Fix #1975
This commit is contained in:
parent
7b1ed5c5eb
commit
63c169b0a8
1 changed files with 0 additions and 35 deletions
|
@ -1,35 +0,0 @@
|
|||
import * as readline from 'readline';
|
||||
|
||||
/**
|
||||
* Indicator
|
||||
*/
|
||||
export default class {
|
||||
private clock: NodeJS.Timer;
|
||||
|
||||
constructor(text: string) {
|
||||
let i = 0; // Dots counter
|
||||
|
||||
draw();
|
||||
this.clock = setInterval(draw, 300);
|
||||
|
||||
function draw(): void {
|
||||
cll();
|
||||
i = (i + 1) % 4;
|
||||
const dots = new Array(i + 1).join('.');
|
||||
process.stdout.write(text + dots); // Write text
|
||||
}
|
||||
}
|
||||
|
||||
public end(): void {
|
||||
clearInterval(this.clock);
|
||||
cll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear current line
|
||||
*/
|
||||
function cll(): void {
|
||||
readline.clearLine(process.stdout, 0); // Clear current text
|
||||
readline.cursorTo(process.stdout, 0, null); // Move cursor to the head of line
|
||||
}
|
Loading…
Reference in a new issue