import { getSkinPath } from "../utils";

export default class ComponentBase extends eui.Component {
    protected data: any;
    constructor() {
        super();
        this.data = {};
        this.skinName = getSkinPath(this.skinKey);
        this.addEventListener(egret.Event.COMPLETE, this.onSkinComplete, this);
        if (this.skin) {
            this.onSkinComplete();
        }
    }

    protected initEvents() { }

    protected removeEvents() { }

    start(data?) {

    }

    protected get skinKey() { return null }

    protected onSkinComplete() {
        this.initEvents();
    }

    destroy() {
        this.removeEvents();
    }
    
}