# Code coverage report for RxJS/dist/cjs/subjects/SubjectSubscription.js

## Statements: 92.68% (38 / 41) Branches: 66.67% (18 / 27) Functions: 100% (6 / 6) Lines: 96.97% (32 / 33) Ignored: none

All files » RxJS/dist/cjs/subjects/ » SubjectSubscription.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

    1

    2

    863

    1

    1

    1

    1

    1

    1
    1

    1
    863

    863
    863
    863
    863

    1
    775

    775
    775
    775
    775
    775
    564

    211
    211

    211
    211
    211

    1

    1
    1'use strict';

    exports.__esModule = true;

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

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

    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; }

    var _Subscription2 = require('../Subscription');

    var _Subscription3 = _interopRequireDefault(_Subscription2);

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

    var _Subscriber2 = _interopRequireDefault(_Subscriber);

    var SubjectSubscription = (function (_Subscription) {
        _inherits(SubjectSubscription, _Subscription);

        function SubjectSubscription(subject, observer) {
            _classCallCheck(this, SubjectSubscription);

            _Subscription.call(this);
            this.subject = subject;
            this.observer = observer;
            this.isUnsubscribed = false;
        }

        SubjectSubscription.prototype.unsubscribe = function unsubscribe() {
            Iif (this.isUnsubscribed) {
                return;
            }
            this.isUnsubscribed = true;
            var subject = this.subject;
            var observers = subject.observers;
            this.subject = void 0;
            if (!observers || observers.length === 0 || subject.isUnsubscribed) {
                return;
            }
            Eif (this.observer instanceof _Subscriber2['default']) {
                this.observer.unsubscribe();
            }
            var subscriberIndex = observers.indexOf(this.observer);
            Eif (subscriberIndex !== -1) {
                observers.splice(subscriberIndex, 1);
            }
        };

        return SubjectSubscription;
    })(_Subscription3['default']);

    exports['default'] = SubjectSubscription;
    module.exports = exports['default'];