The helper bot for LHT https://lhtranslation.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Senko/util/log/ora.js

18 lines
534 B

const ora = require('ora');
module.exports = async (text, promise, callback) => {
return new Promise(async (resolve, reject) => {
let spin = ora(text).start();
return await promise
.catch(e => {
spin.stop();
spin.clear();
return reject(e)
})
.then((...args) => {
spin.stop();
spin.clear();
return callback ? resolve(callback(spin, args)) : resolve(true);
});
});
};