import { __awaiter } from "tslib";
/**
 * Dynamic item extension base class
 */
export class DynamicItemExtensionBase {
    //######################### constructor #########################
    constructor(metadata) {
        this.metadata = metadata;
        /**
         * Indication whether was extension initialized
         */
        this.initialized = false;
    }
    //######################### public methods - implementation of DynamicItemExtension #########################
    /**
     * @inheritdoc
     */
    initialize(injector, element, instance) {
        return __awaiter(this, void 0, void 0, function* () {
            this.initialized = true;
            this.injector = injector;
            this.element = element;
            this.instance = instance;
            yield this.onInit();
        });
    }
    /**
     * @inheritdoc
     */
    optionsChange(options) {
        return __awaiter(this, void 0, void 0, function* () {
            this.options = options;
            if (!this.initialized) {
                return;
            }
            yield this.onOptionsChange();
        });
    }
    /**
     * @inheritdoc
     */
    destroy() {
        this.onDestroy();
    }
    //######################### protected methods #########################
    /**
     * Called on initialization of component
     */
    onInit() {
    }
    /**
     * Called on change of options of component
     */
    onOptionsChange() {
    }
    /**
     * Called on destruction of component
     */
    onDestroy() {
    }
}
//# sourceMappingURL=dynamicItemExtensionBase.js.map