# Code coverage report for RxJS/dist/cjs/schedulers/FutureAction.js

## Statements: 89.36% (42 / 47) Branches: 65.38% (17 / 26) Functions: 100% (8 / 8) Lines: 92.31% (36 / 39) Ignored: none

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

    1

    1

    17

    1

    1

    1

    1
    1

    1
    17

    17
    17
    17

    1
    27

    27

    27

    27
    27
    27
    27

    27
    27
    24
    24
    24

    27

    1
    16
    16
    3
    3

    16

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

    var _ImmediateAction3 = _interopRequireDefault(_ImmediateAction2);

    var FutureAction = (function (_ImmediateAction) {
        _inherits(FutureAction, _ImmediateAction);

        function FutureAction(scheduler, work) {
            _classCallCheck(this, FutureAction);

            _ImmediateAction.call(this, scheduler, work);
            this.scheduler = scheduler;
            this.work = work;
        }

        FutureAction.prototype.schedule = function schedule(state) {
            var _this = this;

            var delay = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];

            Iif (this.isUnsubscribed) {
                return this;
            }
            this.delay = delay;
            this.state = state;
            var id = this.id;
            Iif (id != null) {
                this.id = undefined;
                clearTimeout(id);
            }
            var scheduler = this.scheduler;
            this.id = setTimeout(function () {
                _this.id = void 0;
                scheduler.actions.push(_this);
                scheduler.flush();
            }, this.delay);
            return this;
        };

        FutureAction.prototype.unsubscribe = function unsubscribe() {
            var id = this.id;
            if (id != null) {
                this.id = void 0;
                clearTimeout(id);
            }
            _ImmediateAction.prototype.unsubscribe.call(this);
        };

        return FutureAction;
    })(_ImmediateAction3['default']);

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