
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@porkchopsandwich/progress-tracker
Advanced tools
Sequential or parallel progress tracking, and nested progress trackers.
Sequential or parallel progress tracking, and nested progress trackers.
Requires support (native or polyfill) for Map/Set/WeakMap.
npm install --save @porkchopsandwich/progress-tracker
Three Progress Trackers are available:
const progressTracker = sequentialProgressTracker(maxStates);)
const progressTracker = indexedProgressTracker(maxStates);)
const progressTracker = parentProgressTracker();)
In TypeScript, use a string union to limit the valid progress states for a progress tracker:
type States = "success" | "failure";
const progressTracker = sequentialProgressTracker<States>(5);
Sequential Progress Trackers are progressed by passing in the next progress value, or values:
// Single next value
progressTracker.progress("success");
// Multiple values
progressTracker.progress("success", "failure", "success");
Indexed Progress Trackers are progressed by indicating the (0-based) index to update, and the new value:
progressTracker.progress(2, "failure");
Progress Trackers publish events when they are updated. These can be subscribed to with .subscribe(). The current state can be read at any time with .getCurrentState().
const subscription = progressTracker.subscribe((state) => {
// Do something
});
// When finished, unsubscribe to stop receiving events
subscription.unsubscribe();
// Get the current state at any time:
const currentState = progressTracker.getCurrentState();
The state object received by listeners, or returned by getCurrentState() looks like:
In addition, Parent Progress Trackers have:
WeakMap whose keys are the child progress trackers, and whose values are those trackers' current states.For example:
{
maxState: 5,
progressedState: 3,
stateMap: {
success: 2,
failure: 1,
},
stateList: ["success", "failure", "success"],
// If it is a parent tracker state
childStates: WeakMap<ProgressTracker, ProgressTrackerState>,
}
FAQs
Sequential or parallel progress tracking, and nested progress trackers.
We found that @porkchopsandwich/progress-tracker 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.