"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Cursor = void 0; const onExit = require("signal-exit"); const ansi_1 = require("./ansi"); class Cursor { static show() { if (Cursor.stream.isTTY) { Cursor._isVisible = true; Cursor.stream.write(ansi_1.EscapeCode.cursorShow()); } } static hide() { if (Cursor.stream.isTTY) { if (!Cursor._listenerAttached) { onExit(() => { Cursor.show(); }); Cursor._listenerAttached = true; } Cursor._isVisible = false; Cursor.stream.write(ansi_1.EscapeCode.cursorHide()); } } static toggle() { if (Cursor._isVisible) { Cursor.hide(); } else { Cursor.show(); } } } exports.Cursor = Cursor; Cursor.stream = process.stderr; Cursor._isVisible = true; Cursor._listenerAttached = false;
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
ansi.d.ts | File | 751 B | 0644 |
|
ansi.js | File | 1.05 KB | 0644 |
|
cursor.d.ts | File | 248 B | 0644 |
|
cursor.js | File | 1002 B | 0644 |
|
format.d.ts | File | 1.56 KB | 0644 |
|
format.js | File | 4.73 KB | 0644 |
|
index.d.ts | File | 100 B | 0644 |
|
index.js | File | 315 B | 0644 |
|
info.d.ts | File | 752 B | 0644 |
|
info.js | File | 1.64 KB | 0644 |
|