Package Exports
- progress-smoother
- progress-smoother/dist/main.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (progress-smoother) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
progress-smoother
Smoothing Function for Progress Bars
Installation
npm install progress-smoother
Usage
const { ProgressSmoother } = require("progress-smoother")
const progress = ProgressSmoother({
// Required.
maxValue: 12345, // Maximum value of your progress bar.
valueIncreaseRatePerSecond: 5000, // Estimated minimum throughput for '.setValue()' calls.
valueIncreaseDelta: 500, // Estimated minimum delta between '.setValue()' calls.
averageTimeBetweenValues: 5000, // Estimated mean time between '.setValue()' calls in milliseconds.
minDelayUntilFirstValue: 6000, // Estimated minimum delay until the first '.setValue()' call is made.
// Optional.
teardownTime: 2000 // Latency your app introduces after 100% progress (the function incorporates it).
});
// Report progress events:
progress.setValue(1025);
progress.setValue(3201);
...
progress.setValue(12345);
// Get smoothed progress any time (e.g. on a fixed interval):
progress.smoothedFactor(); // Returns 0..1
Contribute
If you would like to contribute to progress-smoother
:
- Add a GitHub Star to the project (if you're feeling generous!).
- Determine whether you're raising a bug, feature request or question.
- Raise your issue or PR. 🚀