4.0.1 • Published 1 year ago
stdout-update v4.0.1
Purely and accurately overwrites the previous output in the terminal, while maintaining the history of third-party logs.
Install
npm install stdout-update
Usage
import UpdateManager from 'stdout-update';
const TICKS = 60;
const TIMEOUT = 80;
const manager = UpdateManager.getInstance();
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
const messages = ['Swapping time and space...', 'Have a good day.', "Don't panic...", 'Updating Updater...', '42'];
let ticks = TICKS;
let i = 0;
manager.hook();
// eslint-disable-next-line no-console
console.log(' - log message');
// eslint-disable-next-line no-console
console.error(' - error message');
// eslint-disable-next-line no-console
console.warn(' - warn message');
const id = setInterval(() => {
if (--ticks < 0) {
clearInterval(id);
manager.update(['✔ Success', '', 'Messages:', 'this line is be deleted!!!']);
manager.erase(1);
manager.unhook(false);
} else {
const frame = frames[(i = ++i % frames.length)];
const index = Math.round(ticks / 10) % messages.length;
const message = messages[index];
if (message) manager.update([`${frame} Some process...`, message]);
}
}, TIMEOUT);
Examples
tasktree-cli - simple terminal task tree, helps you keep track of your tasks in a tree structure.
API
Read the API documentation for more information.
4.0.1
1 year ago
4.0.0
2 years ago
3.1.1
3 years ago
3.1.0
3 years ago
3.0.4
3 years ago
3.0.6
3 years ago
3.0.5
3 years ago
3.0.3
3 years ago
3.0.2
3 years ago
3.0.1
3 years ago
3.0.0
3 years ago
2.0.4
4 years ago
2.0.3
4 years ago
2.0.1
4 years ago
2.0.0
4 years ago
1.6.8
4 years ago
1.6.7
4 years ago
1.6.6
4 years ago
1.6.5
4 years ago
1.6.4
4 years ago
1.6.3
4 years ago
1.6.2
4 years ago
1.6.1
4 years ago
1.5.0
5 years ago
1.4.1
5 years ago
1.3.7
6 years ago
1.3.6
6 years ago
1.3.5
6 years ago
1.3.4
6 years ago
1.3.3
6 years ago
1.3.2
6 years ago
1.3.1
6 years ago
1.3.0
6 years ago
1.2.1
6 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago