data-worker
Runs a worker function on interval. Every worker instance can be started, stopped, get running status. Optionally name your worker and the worker will be named to what ever you name it + an unique id.
Example code:
const createWorker = require('data-worker')
const myWorker = createWorker({worker: () => console.log('Doing som work...'), interval: 30000, name: 'my-worker'})
myWorker.start()
console.log(myWorker.isRunning())
console.log(myWorker.name())
myWorker.stop()
console.log(myWorker.isRunning())
Run test:
npm test
Configured for use with wallaby testing tool.