UNPKG

446 BJavaScriptView Raw
1const ora = require('ora');
2const consoleClear = require('console-clear');
3
4const methods = ['start', 'succeed'];
5const spinner = ora({ spinner: 'arc' });
6
7// Default to clear screen each time.
8spinner.shouldClear = true;
9
10for (let method of methods) {
11 const tempMethod = spinner[method];
12 spinner[method] = function(...arg) {
13 if (spinner.shouldClear) consoleClear(true);
14 tempMethod.apply(this, arg);
15 };
16}
17
18module.exports = spinner;