all files / modules/ base-module.js

100% Statements 45/45
100% Branches 4/4
100% Functions 12/12
100% Lines 45/45
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61   211× 211× 211×   298×     277×   211×   27×   858× 568×   290× 290×   375× 375×   211× 211× 211× 211× 211× 211× 211×   375× 210×   165× 165× 165× 165× 165× 165× 165×        
define(["require", "exports", "@syncfusion/ej2-base", "../base/events"], function (require, exports, ej2_base_1, events) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var Base = (function () {
        function Base(parent, module) {
            this.parent = parent;
            this.module = module;
            this.addEventListener();
        }
        Base.prototype.render = function (e) {
            this.module.render(e);
        };
        Base.prototype.showPopup = function () {
            this.module.showPopup();
        };
        Base.prototype.focus = function () {
            this.module.focus();
        };
        Base.prototype.update = function (e) {
            this.module.updateValue(e);
        };
        Base.prototype.getValue = function () {
            this.module.getRenderValue();
        };
        Base.prototype.destroyComponent = function () {
            if (ej2_base_1.isNullOrUndefined(this.module.compObj)) {
                return;
            }
            this.module.compObj.destroy();
            this.module.compObj = undefined;
        };
        Base.prototype.destroy = function () {
            this.destroyComponent();
            this.removeEventListener();
        };
        Base.prototype.addEventListener = function () {
            this.parent.on(events.render, this.render, this);
            this.parent.on(events.setFocus, this.focus, this);
            this.parent.on(events.showPopup, this.showPopup, this);
            this.parent.on(events.update, this.update, this);
            this.parent.on(events.accessValue, this.getValue, this);
            this.parent.on(events.destroyModules, this.destroyComponent, this);
            this.parent.on(events.destroy, this.destroy, this);
        };
        Base.prototype.removeEventListener = function () {
            if (this.parent.isDestroyed) {
                return;
            }
            this.parent.off(events.render, this.render);
            this.parent.off(events.setFocus, this.focus);
            this.parent.off(events.showPopup, this.showPopup);
            this.parent.off(events.update, this.update);
            this.parent.off(events.accessValue, this.getValue);
            this.parent.off(events.destroyModules, this.destroyComponent);
            this.parent.off(events.destroy, this.destroy);
        };
        return Base;
    }());
    exports.Base = Base;
});