
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign hits npm.
@antongolub/repeater
Advanced tools
Helper for creating auto-calling functions
The wheel was invented a long time ago: repeat. What's the diff?
manual and automated calls. import repeater from '@antongolub/repeater'
const target = step => { this.i += step }
const context = { i: 0 }
const delay = 1000
const rep = repeater(target, delay, context)
rep(2)
// Imagine, 5 seconds later new 'manual' call occurs
setTimeout(() => rep(1), 5000)
// ~10 seconds after start:
setTimeout(() => console.log(context.i), 10000) // 15
Repeater is just a wrapper around the target function. It exposes several util props:
| Prop | Description |
|---|---|
delay | interval in ms |
timeout | TimeoutID |
target | ref for original target function |
context | optional scope |
limit | optional remainder of calls |
args | arguments of the last invocation |
So, anytime you're let to interrupt the repetitive call by clearing timeout:
clearTimeout(rep.timeout)
const rep1 = repeater(target, delay, context, limit)
const rep2 = repeater({target, delay, context, limit})
FAQs
Helper for creating auto-calling functions
We found that @antongolub/repeater demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Another wave of Shai-Hulud campaign hits npm.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.