
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
nlist-stopwatchjs
Advanced tools
A simple JavaScript library implementing a stopwatch typically used in timing middle distance fun runs/races.
Note this is a simple stopwatch timer using the setInterval function, be aware of the caveats when using.
To use with the browser:
<script src="path/to/yourCopyOf/stopwatch.js"></script>
you can also import the named exports stopWatch and msToTime from stopwatch.js using ES6 module static import statement:
import { stopWatch, msToTime } from './path/to/yourCopyOf/stopwatch.js';
stopwatch.js exports the stopWatch object and the msToTime function.
msToTime is a simple function that translates ms to "hh:mm:ss:---" format.
The stopWatch objects encapsulates all the functions needed for implementing a basic stopWatch.
stopWatch.setConfig = {
tickerFunction:()=>{},
tickerInterval:250,
distanceMarkers:[]
}
() => {console.log("Time Elapsed ",this.getElapsedTime," ms")
[2.5,5.0,7.5] could be used for a 10 km run with a 2.5 km lap, allowing pace feedback to runners after every lap.stopWatch.startTimer()Starts the timer, firing the tickerFunction after every interval, and records the starting time.
stopWatch.stopTimer()Stops the timer and records the elapsed time, and finishing time.
stopWatch.togglePause()Pauses the timer, and records the time when paused, so that on restart the time paused is subtracted from the start - finish time.
stopWatch.resetTimer()Resets the stopWatch, without clearing the configuration set by stopWatch.setConfig
stopWatch.clearConfig()Equivalent to
stopWatch.setConfig = {
tickerFunction: null,
tickerInterval: null,
distanceMarkers: []
}
stopWatch.calculatePacea getter that returns an Array containing the pace at every distancemarker based on the elapsed time.
stopWatch.getTickerTimea getter that returns the last time setInterval executed the callback. Use JavaScript .toLocaleTimeString() to convert to localized time format.
stopWatch.getElapsedTimea getter returning the time elapsed from the start time to the last time setInterval executed the callback.
stopWatch.recordSplit()Pushes the last split time onto the splits Array.
stopWatch.getSplitsa getter that returns an Array of the splits.
msToTime(time)Converts time in ms to "HH:MM:SS:sss" format
FAQs
Simple stopwatch library
We found that nlist-stopwatchjs 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.

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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.