1const log = require('./log-shim.js') 2 3let pulseTimer = null 4const withPromise = async (promise) => { 5 pulseStart() 6 try { 7 return await promise 8 } finally { 9 pulseStop() 10 } 11} 12 13const pulseStart = () => { 14 pulseTimer = pulseTimer || setInterval(() => { 15 log.gauge.pulse('') 16 }, 150) 17} 18 19const pulseStop = () => { 20 clearInterval(pulseTimer) 21 pulseTimer = null 22} 23 24module.exports = { 25 withPromise, 26} 27