all files / rich-text-editor/services/ renderer-factory.js

100% Statements 18/18
100% Branches 4/4
100% Functions 6/6
100% Lines 18/18
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   1818×   9414× 9414× 7412×     29825× 29825×     29824×     1817×        
define(["require", "exports", "@syncfusion/ej2-base", "../base/enum"], function (require, exports, ej2_base_1, enum_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var RendererFactory = (function () {
        function RendererFactory() {
            this.rendererMap = {};
        }
        RendererFactory.prototype.addRenderer = function (name, type) {
            var rName = ej2_base_1.getEnumValue(enum_1.RenderType, name);
            if (ej2_base_1.isNullOrUndefined(this.rendererMap["" + rName])) {
                this.rendererMap["" + rName] = type;
            }
        };
        RendererFactory.prototype.getRenderer = function (name) {
            var rName = ej2_base_1.getEnumValue(enum_1.RenderType, name);
            if (ej2_base_1.isNullOrUndefined(this.rendererMap["" + rName])) {
                throw "The renderer " + rName + " is not found";
            }
            else {
                return this.rendererMap["" + rName];
            }
        };
        RendererFactory.prototype.destroy = function () {
            this.rendererMap = {};
        };
        return RendererFactory;
    }());
    exports.RendererFactory = RendererFactory;
});