Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / retry.js
1 import { Subscriber } from '../Subscriber';
2 export function retry(count = -1) {
3     return (source) => source.lift(new RetryOperator(count, source));
4 }
5 class 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 }
14 class 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