"use strict";
var __reflect = (this && this.__reflect) || function (p, c, t) {
    p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) { 
 function r() { 
 this.constructor = t;
}
for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var ComponentBase = (function (_super) {
    __extends(ComponentBase, _super);
    function ComponentBase(data) {
        var _this = _super.call(this) || this;
        _this.data = data ? data : {};
        _this.skinName = utils_1.getSkinPath(_this.skinKey);
        if (_this.skin) {
            _this.onSkinComplete();
        }
        else {
            _this.addEventListener(egret.Event.COMPLETE, _this.onSkinComplete, _this);
        }
        return _this;
    }
    // 添加点击
    ComponentBase.prototype.onTap = function (target, func) {
        target.addEventListener(egret.TouchEvent.TOUCH_TAP, func, this);
    };
    ComponentBase.prototype.onTapBegin = function (target, func) {
        target.addEventListener(egret.TouchEvent.TOUCH_BEGIN, func, this);
    };
    ComponentBase.prototype.onTapEnd = function (target, func) {
        target.addEventListener(egret.TouchEvent.TOUCH_END, func, this);
    };
    // 移除点击事件
    ComponentBase.prototype.clearTap = function (target, func) {
        target.removeEventListener(egret.TouchEvent.TOUCH_TAP, func, this);
    };
    ComponentBase.prototype.clearTapBegin = function (target, func) {
        target.removeEventListener(egret.TouchEvent.TOUCH_BEGIN, func, this);
    };
    ComponentBase.prototype.clearTapEnd = function (target, func) {
        target.removeEventListener(egret.TouchEvent.TOUCH_END, func, this);
    };
    // 打印
    ComponentBase.prototype.log = function (msg) {
        console.log(msg);
    };
    ComponentBase.prototype.initEvents = function () { };
    ComponentBase.prototype.removeEvents = function () { };
    ComponentBase.prototype.start = function (data) {
    };
    Object.defineProperty(ComponentBase.prototype, "skinKey", {
        get: function () { return null; },
        enumerable: true,
        configurable: true
    });
    ComponentBase.prototype.onSkinComplete = function () {
        this.initEvents();
    };
    ComponentBase.prototype.destroy = function () {
        this.removeEvents();
    };
    return ComponentBase;
}(eui.Component));
exports.default = ComponentBase;
__reflect(ComponentBase.prototype, "\"e:/zqty/egret/src/components/ComponentBase\".ComponentBase");
//# sourceMappingURL=ComponentBase.js.map