all files / grid/services/ renderer-factory.js

100% Statements 16/16
100% Branches 4/4
100% Functions 5/5
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 27   1195×   2519× 2519× 2391×     9359× 9359×     9358×          
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];
            }
        };
        return RendererFactory;
    }());
    exports.RendererFactory = RendererFactory;
});