# Code coverage report for RxJS/dist/cjs/operators/retryWhen.js

## Statements: 95.38% (62 / 65) Branches: 65% (13 / 20) Functions: 100% (17 / 17) Lines: 98.25% (56 / 57) Ignored: none

All files » RxJS/dist/cjs/operators/ » retryWhen.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106

    1
    1

    3

    2

    6

    1

    1

    1

    1

    1

    1

    1

    1
    2

    1
    1
    2

    2
    2

    1
    2

    1

    1
    1

    1
    2

    2
    2
    2

    1
    3
    2
    2
    2

    2
    2

    3

    1
    1

    1
    1

    1

    1
    1

    1
    2

    2
    2

    1
    1

    1
    1

    1
    1

    1

    1'use strict';

    exports.__esModule = true;
    exports['default'] = retryWhen;

    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

    function _inherits(subClass, superClass) { Iif (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); Eif (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

    function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

    var _Subscriber3 = require('../Subscriber');

    var _Subscriber4 = _interopRequireDefault(_Subscriber3);

    var _Subject = require('../Subject');

    var _Subject2 = _interopRequireDefault(_Subject);

    var _utilTryCatch = require('../util/tryCatch');

    var _utilTryCatch2 = _interopRequireDefault(_utilTryCatch);

    var _utilErrorObject = require('../util/errorObject');

    function retryWhen(notifier) {
        return this.lift(new RetryWhenOperator(notifier, this));
    }

    var RetryWhenOperator = (function () {
        function RetryWhenOperator(notifier, original) {
            _classCallCheck(this, RetryWhenOperator);

            this.notifier = notifier;
            this.original = original;
        }

        RetryWhenOperator.prototype.call = function call(subscriber) {
            return new RetryWhenSubscriber(subscriber, this.notifier, this.original);
        };

        return RetryWhenOperator;
    })();

    var RetryWhenSubscriber = (function (_Subscriber) {
        _inherits(RetryWhenSubscriber, _Subscriber);

        function RetryWhenSubscriber(destination, notifier, original) {
            _classCallCheck(this, RetryWhenSubscriber);

            _Subscriber.call(this, destination);
            this.notifier = notifier;
            this.original = original;
        }

        RetryWhenSubscriber.prototype._error = function _error(err) {
            if (!this.retryNotifications) {
                this.errors = new _Subject2['default']();
                var notifications = _utilTryCatch2['default'](this.notifier).call(this, this.errors);
                Iif (notifications === _utilErrorObject.errorObject) {
                    this.destination.error(_utilErrorObject.errorObject.e);
                } else {
                    this.retryNotifications = notifications;
                    this.add(notifications._subscribe(new RetryNotificationSubscriber(this)));
                }
            }
            this.errors.next(err);
        };

        RetryWhenSubscriber.prototype.finalError = function finalError(err) {
            this.destination.error(err);
        };

        RetryWhenSubscriber.prototype.resubscribe = function resubscribe() {
            this.original.subscribe(this);
        };

        return RetryWhenSubscriber;
    })(_Subscriber4['default']);

    var RetryNotificationSubscriber = (function (_Subscriber2) {
        _inherits(RetryNotificationSubscriber, _Subscriber2);

        function RetryNotificationSubscriber(parent) {
            _classCallCheck(this, RetryNotificationSubscriber);

            _Subscriber2.call(this, null);
            this.parent = parent;
        }

        RetryNotificationSubscriber.prototype._next = function _next(value) {
            this.parent.resubscribe();
        };

        RetryNotificationSubscriber.prototype._error = function _error(err) {
            this.parent.finalError(err);
        };

        RetryNotificationSubscriber.prototype._complete = function _complete() {
            this.parent.complete();
        };

        return RetryNotificationSubscriber;
    })(_Subscriber4['default']);

    module.exports = exports['default'];