1 | const ora = require('ora');
|
2 | const consoleClear = require('console-clear');
|
3 |
|
4 | const methods = ['start', 'succeed'];
|
5 | const spinner = ora({ spinner: 'arc' });
|
6 |
|
7 | // Default to clear screen each time.
|
8 | spinner.shouldClear = true;
|
9 |
|
10 | for (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 |
|
18 | module.exports = spinner;
|