repeat-me

0.2.0 • Public • Published

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()

Readme

Keywords

Package Sidebar

Install

npm i repeat-me

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • buren