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

## Statements: 90.63% (29 / 32) Branches: 60% (12 / 20) Functions: 100% (7 / 7) Lines: 95.83% (23 / 24) Ignored: none

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

    1

    1

    7

    1

    1

    1

    1
    1

    1
    7

    7
    7

    1
    6
    6

    6
    6

    6

    1
    17

    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 _Subject2 = require('../Subject');

    var _Subject3 = _interopRequireDefault(_Subject2);

    var BehaviorSubject = (function (_Subject) {
        _inherits(BehaviorSubject, _Subject);

        function BehaviorSubject(value) {
            _classCallCheck(this, BehaviorSubject);

            _Subject.call(this);
            this.value = value;
        }

        BehaviorSubject.prototype._subscribe = function _subscribe(subscriber) {
            var subscription = _Subject.prototype._subscribe.call(this, subscriber);
            Iif (!subscription) {
                return;
            } else Eif (!subscription.isUnsubscribed) {
                subscriber.next(this.value);
            }
            return subscription;
        };

        BehaviorSubject.prototype._next = function _next(value) {
            _Subject.prototype._next.call(this, this.value = value);
        };

        return BehaviorSubject;
    })(_Subject3['default']);

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