https://github.com/buren/repeat-me
Simplest possible JS repeater.
https://github.com/buren/repeat-me
Last synced: 3 months ago
JSON representation
Simplest possible JS repeater.
- Host: GitHub
- URL: https://github.com/buren/repeat-me
- Owner: buren
- Created: 2016-11-16T15:48:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-12-01T00:56:13.000Z (over 3 years ago)
- Last Synced: 2025-02-19T17:06:11.646Z (4 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# repeat-me
Simple JavaScript repeater.
```js
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()
```