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

92.86% Statements 13/14
50% Branches 2/4
100% Functions 5/5
92.86% Lines 13/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23   121×   9585×     9585×   847× 847×          
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) {
            Iif (ej2_base_1.isNullOrUndefined(this.services[name])) {
                throw "The service " + name + " is not registered";
            }
            return this.services[name];
        };
        ServiceLocator.prototype.register = function (name, type) {
            Eif (ej2_base_1.isNullOrUndefined(this.services[name])) {
                this.services[name] = type;
            }
        };
        return ServiceLocator;
    }());
    exports.ServiceLocator = ServiceLocator;
});