0.2.0 • Published 7 years ago
repeat-me v0.2.0
repeat-me
Simple JavaScript repeater.
const RepeatMe = require('./repeat-me')
const timeout = 100 // 0.1 second
const logCount = count => console.log(count)
// Both these options are optional
const options = {
maxCalls: 5, // optional (default: Infinity)
finished: logCount // optional
}
// Start the repeat function
const repeater = new RepeatMe(logCount, timeout, options)
repeater.stop() // stop the repeater if you want to
repeater.start() // start it again
// get the current number of calls to repeat function
repeater.getCalledCount()