all files / src/datasource/ datasourcePluginRegistry.ts

89.29% Statements 25/28
66.67% Branches 6/9
85.71% Functions 6/7
96% Lines 24/25
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                    64×          
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var pluginRegistry_1 = require("../pluginApi/pluginRegistry");
var datasourcePluginFactory_1 = require("./datasourcePluginFactory");
var DatasourcePluginRegistry = (function (_super) {
    __extends(DatasourcePluginRegistry, _super);
    function DatasourcePluginRegistry(_store) {
        _super.call(this, _store);
        this._disposed = false;
    }
    Object.defineProperty(DatasourcePluginRegistry.prototype, "disposed", {
        get: function () {
            return this._disposed;
        },
        enumerable: true,
        configurable: true
    });
    DatasourcePluginRegistry.prototype.createPluginFromModule = function (module) {
        console.assert(_.isObject(module.TYPE_INFO), "Missing TYPE_INFO on datasource module. Every module must export TYPE_INFO");
        return new datasourcePluginFactory_1.default(module.TYPE_INFO.type, module.Datasource, this.store);
    };
    DatasourcePluginRegistry.prototype.dispose = function () {
        if (!this._disposed) {
            this._disposed = true;
            clearInterval(this._fetchIntervalRef);
            this._fetchIntervalRef = null;
            _super.prototype.dispose.call(this);
        }
    };
    return DatasourcePluginRegistry;
}(pluginRegistry_1.default));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = DatasourcePluginRegistry;