https://github.com/javierbyte/time-remaning-estimator
Estimate the remaining time for any process with known progress.
https://github.com/javierbyte/time-remaning-estimator
Last synced: 7 days ago
JSON representation
Estimate the remaining time for any process with known progress.
- Host: GitHub
- URL: https://github.com/javierbyte/time-remaning-estimator
- Owner: javierbyte
- Created: 2017-01-10T05:37:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-10T05:56:45.000Z (over 8 years ago)
- Last Synced: 2025-02-24T01:16:21.109Z (4 months ago)
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Time Remaining Estimator.
Estimate the time remaining for any process with known progress (Exponentially Weighted Moving Average implementation).
# Usage
### Automatic Timestamp.
```js
const estimator = new TimeRemainingEstimator.auto({
maxValue: 100
})onProgress(function(newProgressValue) {
/* once you register progress, you can add it to the estimate
* to improve estimation
*/
estimator.add({
value: newProgressValue
})estimator.calculate()
// {finalDate: , remainingTime: }
})
```### Absolute Timestamp.
```js
const estimator = new TimeRemainingEstimator.absolute({
maxValue: 100,
startTime: processStartDate
})onProgress(function(newProgressValue) {
/* here you can add points at any time in any order
* new points with the same time will override previous ones
*/
estimator.add({
value: newProgressValue,
time: new Date()
})estimator.calculate({
time: new Date()
})
// {finalDate: , remainingTime: }
})
```### Functional Usage.
```
TimeRemainingEstimator.functional({
maxValue: 100,
startTime: ,
currentTime: ,
steps: [{
time: ,
value: 1
}, {
time: ,
value: 3
}, {
time: ,
value: 23
}, {
time: ,
value: 55
}]
})
// returns {finalDate: , remainingTime: }
```## How it works.
Implementation of https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average