backoff-rxjs
Advanced tools
Comparing version 0.0.2 to 0.0.3
export { retryBackoffExponential, RetryBackoffExponentialConfig } from './operators/retryBackoffExponential'; | ||
export { intervalExponential, IntervalExponentialConfig } from './observable/intervalExponential'; | ||
export { intervalBackoffExponential, IntervalBackoffExponentialConfig } from './observable/intervalBackoffExponential'; |
export { retryBackoffExponential } from './operators/retryBackoffExponential'; | ||
export { intervalExponential } from './observable/intervalExponential'; | ||
export { intervalBackoffExponential } from './observable/intervalBackoffExponential'; |
{ | ||
"name": "backoff-rxjs", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A collection of helpful RxJS operators to deal with backoff strategies (like exponential backoff)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# backoff-rxjs | ||
A collection of helpful RxJS operators to deal with backoff strategies (like exponential backoff) | ||
## intervalExponential | ||
![Basic interval Exponential](./intervalExponentialBasic.svg) | ||
`intervalExponential` works similiarly to `interval` except that it doubles the delay between emissions every time. | ||
| name | type | attirbute | description | | ||
| ------------- |-------------| -----| ---------------| | ||
| config | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [IntervalExponentialConfig](https://github.com/alex-okrushko/backoff-rxjs/blob/277fbbbde4b046733070e2ed64e0b765699fb66b/src/observable/intervalExponential.ts#L6)| required |Can take number as initial interval or a config with initial interval and optional max Interval | | ||
`intervalExponential` is especially useful for periodic polls that are reset whenever user activity is detected: | ||
```ts | ||
fromEvent(document, 'mousemove').pipe( | ||
// There could be many mousemoves, we'd want to sample only | ||
// with certain frequency | ||
sampleTime(LOAD_INTERVAL_MS), | ||
// Start immediately | ||
startWith(null), | ||
// Resetting exponential interval | ||
switchMapTo(intervalExponential({initialInterval: LOAD_INTERVAL_MS, maxInterval: MAX_INTERVAL_MS})), | ||
); | ||
``` | ||
## retryExponentialBackoff | ||
![Retry Backoff Exponential Image](./retryBackoffExponential.svg) | ||
| name | type | attirbute | description | | ||
| ------------- |-------------| -----| ---------------| | ||
| config | [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) \| [IntervalExponentialConfig](https://github.com/alex-okrushko/backoff-rxjs/blob/277fbbbde4b046733070e2ed64e0b765699fb66b/src/observable/intervalExponential.ts#L6)| required |Can take number as initial interval or a config with initial interval and optional max Interval | |
export {retryBackoffExponential, RetryBackoffExponentialConfig} from './operators/retryBackoffExponential'; | ||
export {intervalExponential, IntervalExponentialConfig} from './observable/intervalExponential'; | ||
export {intervalBackoffExponential, IntervalBackoffExponentialConfig} from './observable/intervalBackoffExponential'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24807
20
198
37