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.
27 lines
412 B
27 lines
412 B
const log = require('./log-shim.js')
|
|
|
|
let pulseTimer = null
|
|
const withPromise = async (promise) => {
|
|
pulseStart()
|
|
try {
|
|
return await promise
|
|
} finally {
|
|
pulseStop()
|
|
}
|
|
}
|
|
|
|
const pulseStart = () => {
|
|
pulseTimer = pulseTimer || setInterval(() => {
|
|
log.gauge.pulse('')
|
|
}, 150)
|
|
}
|
|
|
|
const pulseStop = () => {
|
|
clearInterval(pulseTimer)
|
|
pulseTimer = null
|
|
}
|
|
|
|
module.exports = {
|
|
withPromise,
|
|
}
|