# all files / TypeScript.NET/source/System/Disposable/ DisposableBase.js

88.24% Statements 30/34
66.67% Branches 12/18
87.5% Functions 7/8
90.32% Lines 28/31

    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×
    1×
    1×

    1×
    1×
    1×
    10269×
    10269×

    1×

    1×
    48705×
    48705×
    4×
    48701×

    1×
    3126×
    3126×
    1737×
    1737×
    1737×

    1737×
    9×
    9×

    1×
    1×

    1×
    1×
    1×

     /*!
     * @author electricessence / https://github.com/electricessence/
     * Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE.md
     */
    (function (factory) {
        Eif (typeof module === 'object' && typeof module.exports === 'object') {
            var v = factory(require, exports); Iif (v !== undefined) module.exports = v;
        }
        else if (typeof define === 'function' && define.amd) {
            define(["require", "exports", "./ObjectDisposedException"], factory);
        }
    })(function (require, exports) {
        "use strict";
        var ObjectDisposedException_1 = require("./ObjectDisposedException");
        var DisposableBase = (function () {
            function DisposableBase(__finalizer) {
                this.__finalizer = __finalizer;
                this.__wasDisposed = false;
            }
            Object.defineProperty(DisposableBase.prototype, "wasDisposed", {
                get: function () {
                    return this.__wasDisposed;
                },
                enumerable: true,
                configurable: true
            });
            DisposableBase.prototype.throwIfDisposed = function (message, objectName) {
                if (objectName === void 0) { objectName = this._disposableObjectName; }
                if (this.__wasDisposed)
                    throw new ObjectDisposedException_1.ObjectDisposedException(objectName, message);
                return true;
            };
            DisposableBase.prototype.dispose = function () {
                var _ = this;
                if (!_.__wasDisposed) {
                    _.__wasDisposed = true;
                    try {
                        _._onDispose();
                    }
                    finally {
                        if (_.__finalizer) {
                            _.__finalizer();
                            _.__finalizer = void 0;
                        }
                    }
                }
            };
            DisposableBase.prototype._onDispose = function () { };
            return DisposableBase;
        }());
        exports.DisposableBase = DisposableBase;
        Object.defineProperty(exports, "__esModule", { value: true });
        exports.default = DisposableBase;
    });
    //# sourceMappingURL=DisposableBase.js.map