Files
vue-cli/packages/@vue/cli/lib/util/spinner.js
2017-12-29 00:26:43 -05:00

31 lines
499 B
JavaScript

const ora = require('ora')
const spinner = ora()
let lastMsg
exports.logWithSpinner = (symbol, msg) => {
if (lastMsg) {
spinner.stopAndPersist({
symbol: lastMsg.symbol,
text: lastMsg.text
})
}
spinner.text = ' ' + msg
lastMsg = {
symbol: symbol + ' ',
text: msg
}
spinner.start()
}
exports.stopSpinner = () => {
if (lastMsg) {
spinner.stopAndPersist({
symbol: lastMsg.symbol,
text: lastMsg.text
})
} else {
spinner.stop()
}
}