all files / rich-text-editor/services/ service-locator.js

100% Statements 16/16
100% Branches 4/4
100% Functions 6/6
100% Lines 16/16
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   1833×   5501× 5500×     96371×   96370×   1832×        
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.register = function (name, type) {
            if (ej2_base_1.isNullOrUndefined(this.services["" + name])) {
                this.services["" + name] = type;
            }
        };
        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.destroy = function () {
            this.services = {};
        };
        return ServiceLocator;
    }());
    exports.ServiceLocator = ServiceLocator;
});