callbag-retry

1.0.0 • Public • Published

callbag-retry

Callbag operator which resubscribes to the source given amount of times.

Example

import concat from 'callbag-concat'
import fromIter from 'callbag-from-iter'
import pipe from 'callbag-pipe'
import retry from 'callbag-retry'
import subscribe from 'callbag-subscribe'
import throwError from 'callbag-throw-error'

pipe(
  concat(fromIter([1, 2, 3]), throwError(new Error('Test error.'))),
  retry(3),
  subscribe({
    next: v => {
      // will log 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3
      console.log(v)
    },
    error(err) {
      // errors with 4th `Test error.` error
    },
  }),
)

Readme

Keywords

Package Sidebar

Install

npm i callbag-retry

Weekly Downloads

576

Version

1.0.0

License

MIT

Unpacked Size

4.28 kB

Total Files

4

Last publish

Collaborators

  • andarist