source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/retry.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 961 bytes
Line 
1import { Subscriber } from '../Subscriber';
2export function retry(count = -1) {
3 return (source) => source.lift(new RetryOperator(count, source));
4}
5class RetryOperator {
6 constructor(count, source) {
7 this.count = count;
8 this.source = source;
9 }
10 call(subscriber, source) {
11 return source.subscribe(new RetrySubscriber(subscriber, this.count, this.source));
12 }
13}
14class RetrySubscriber extends Subscriber {
15 constructor(destination, count, source) {
16 super(destination);
17 this.count = count;
18 this.source = source;
19 }
20 error(err) {
21 if (!this.isStopped) {
22 const { source, count } = this;
23 if (count === 0) {
24 return super.error(err);
25 }
26 else if (count > -1) {
27 this.count = count - 1;
28 }
29 source.subscribe(this._unsubscribeAndRecycle());
30 }
31 }
32}
33//# sourceMappingURL=retry.js.map
Note: See TracBrowser for help on using the repository browser.