# Code coverage report for RxJS/dist/cjs/observables/SubscribeOnObservable.js

## Statements: 52.38% (22 / 42) Branches: 28.13% (9 / 32) Functions: 37.5% (3 / 8) Lines: 50% (17 / 34) Ignored: none

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

    1

    2

    1

    1

    1

    1

    1

    1

    1
    1

    1

    1

    1

    1

    1

    1
    1'use strict';

    exports.__esModule = true;

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

    function _classCallCheck(instance, Constructor) { if (!(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 _Observable2 = require('../Observable');

    var _Observable3 = _interopRequireDefault(_Observable2);

    var _schedulersNextTick = require('../schedulers/nextTick');

    var _schedulersNextTick2 = _interopRequireDefault(_schedulersNextTick);

    var SubscribeOnObservable = (function (_Observable) {
        _inherits(SubscribeOnObservable, _Observable);

        function SubscribeOnObservable(source) {
            var delay = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
            var scheduler = arguments.length <= 2 || arguments[2] === undefined ? _schedulersNextTick2['default'] : arguments[2];

            _classCallCheck(this, SubscribeOnObservable);

            _Observable.call(this);
            this.source = source;
            this.delayTime = delay;
            this.scheduler = scheduler;
        }

        SubscribeOnObservable.create = function create(source) {
            var delay = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
            var scheduler = arguments.length <= 2 || arguments[2] === undefined ? _schedulersNextTick2['default'] : arguments[2];

            return new SubscribeOnObservable(source, delay, scheduler);
        };

        SubscribeOnObservable.dispatch = function dispatch(_ref) {
            var source = _ref.source;
            var subscriber = _ref.subscriber;

            return source.subscribe(subscriber);
        };

        SubscribeOnObservable.prototype._subscribe = function _subscribe(subscriber) {
            var delay = this.delayTime;
            var source = this.source;
            var scheduler = this.scheduler;
            subscriber.add(scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
                source: source, subscriber: subscriber
            }));
        };

        return SubscribeOnObservable;
    })(_Observable3['default']);

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