source: trip-planner-front/node_modules/cli-cursor/index.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 617 bytes
Line 
1'use strict';
2const restoreCursor = require('restore-cursor');
3
4let isHidden = false;
5
6exports.show = (writableStream = process.stderr) => {
7 if (!writableStream.isTTY) {
8 return;
9 }
10
11 isHidden = false;
12 writableStream.write('\u001B[?25h');
13};
14
15exports.hide = (writableStream = process.stderr) => {
16 if (!writableStream.isTTY) {
17 return;
18 }
19
20 restoreCursor();
21 isHidden = true;
22 writableStream.write('\u001B[?25l');
23};
24
25exports.toggle = (force, writableStream) => {
26 if (force !== undefined) {
27 isHidden = force;
28 }
29
30 if (isHidden) {
31 exports.show(writableStream);
32 } else {
33 exports.hide(writableStream);
34 }
35};
Note: See TracBrowser for help on using the repository browser.