all files / workbook/services/ service-locator.js

100% Statements 14/14
100% Branches 4/4
100% Functions 5/5
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23   886×   111805×   111804×   6197× 6196×          
define(["require", "exports", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ServiceLocator = (function () {
        function ServiceLocator() {
            this.services = {};
        }
        ServiceLocator.prototype.getService = function (name) {
            if (ej2_base_1.isNullOrUndefined(this.services["" + name])) {
                throw "The service " + name + " is not registered";
            }
            return this.services["" + name];
        };
        ServiceLocator.prototype.register = function (name, type) {
            if (ej2_base_1.isNullOrUndefined(this.services["" + name])) {
                this.services["" + name] = type;
            }
        };
        return ServiceLocator;
    }());
    exports.ServiceLocator = ServiceLocator;
});