From 93e06e6ea171f1ed5de286d92cd7e1b77f46c200 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Thu, 4 Apr 2024 02:35:09 +0400 Subject: [PATCH] Added getter for checking if initialization is completed --- src/lib/components/base/BaseComponent.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/components/base/BaseComponent.js b/src/lib/components/base/BaseComponent.js index a9c1ad4..90838ff 100644 --- a/src/lib/components/base/BaseComponent.js +++ b/src/lib/components/base/BaseComponent.js @@ -51,6 +51,15 @@ export class BaseComponent { return this.#container; } + /** + * Check if the component is initialized already. If not checked, subsequent calls to the `initialize` method will + * throw an error. + * @return {boolean} + */ + get isInitialized() { + return this.#isInitialized; + } + /** * Emit the custom event on the container element. * @param {keyof HTMLElementEventMap|string} event The event name.