Skip to content
A collection of helpful RxJS operators to deal with backoff strategies (like exponential backoff)
Branch: master
Clone or download
nicktobolski and alex-okrushko Update README.md (#14)
The link to the RetryBackoffConfig Interface was pointing to a previous version.
Latest commit 58df105 Feb 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bundles Add support for multiple module systems (cjs, es2015, umd) Feb 6, 2019
scripts Add support for multiple module systems (cjs, es2015, umd) Feb 6, 2019
spec
src rename maxAttempts to maxRetries to align with retry operator (#5) Oct 2, 2018
.DS_Store Make backoffDelay optional May 23, 2018
.gitignore
.npmignore First version May 15, 2018
LICENSE
README.md Update README.md (#14) Feb 13, 2019
cloudbuild.json Set-up CI (#10) Oct 4, 2018
intervalBackoffBasic.svg add ability to specify backoff delay calculation function May 16, 2018
package-dist.json
package-lock.json
package.json Add support for multiple module systems (cjs, es2015, umd) Feb 6, 2019
retryBackoff.svg add ability to specify backoff delay calculation function May 16, 2018
tsconfig-dist-cjs.json
tsconfig-dist-esm2015.json Add support for multiple module systems (cjs, es2015, umd) Feb 6, 2019
tsconfig-dist-esm5.json
tsconfig-dist.json Add support for multiple module systems (cjs, es2015, umd) Feb 6, 2019
tsconfig.json Add support for multiple module systems (cjs, es2015, umd) Feb 6, 2019
webpack.config.js
yarn.lock Add support for multiple module systems (cjs, es2015, umd) Feb 6, 2019

README.md

backoff-rxjs

A collection of helpful RxJS operators to deal with backoff strategies (like exponential backoff) Angular-in-Depth article about this library is at https://blog.angularindepth.com/power-of-rxjs-when-using-exponential-backoff-a4b8bde276b0

intervalBackoff

Basic interval backoff

intervalBackoff works similiarly to interval except that it doubles the delay between emissions every time.

name type attirbute description
config number | IntervalBackoffConfig required Can take number as initial interval or a config with initial interval, optional max Interval and optional backoff delay function (exponential by default)

interval is especially useful for periodic polls that are reset whenever user activity is detected:

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(
    intervalBackoff({
      initialInterval: LOAD_INTERVAL_MS,
      maxInterval: MAX_INTERVAL_MS
    })
  )
);

retryBackoff

Retry Backoff Exponential Image

name type attirbute description
config number | RetryBackoffConfig required Can take number as initial interval or a config with initial interval, optional max Interval, optional max number of retry attempts, optional function to cancel reties and optional backoff delay function (exponential by default)
You can’t perform that action at this time.