
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
shared-tick
Advanced tools
Run function in same setInterval
use npm
npm install shared-tick --save
use yarn
yarn add shared-tick
use pnpm
pnpm install shared-tick
run function per second
import { runTick } from 'shared-tick'
const onTick = () => {
// do something per second
}
runTick({onTick})
run function per 3 second
import { runTick } from 'shared-tick'
const onTick = () => {
// do something per second
}
runTick({onTick, tick: 3000})
stop runner
import { stopTickRunner, runTick } from "shared-tick"
const id = runTick({...})
stopTickRunner(id)
restart runner
import { stopTickRunner, , startTickRunner, runTick } from "shared-tick"
const id = runTick({...})
stopTickRunner(id)
// restart runner after 5sec
setTimeout(() => startTickRunner(id), 5000)
runTick(config)
| Field | Type | Default | Requirement | Description |
|---|---|---|---|---|
| tick | number | 1000 | No | Running interval time |
| id | symbol | Symbol() | No | Identifying objects |
| onTick | (t: number) => void | No | Yes | Runner function, The first parameter is the current timestamp |
stopTickRunner(id: symbol)
startTickRunner(id: symbol)
The files included in this repository are licensed under the MIT license.
FAQs
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.