From e8f702666f285a3e69866ed1f8d29fa6eaaaeabb Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 13 Oct 2021 15:19:28 +0300 Subject: JS: minor refactoring (#35183) * add missing comments * shorten block comments * reorder constants * reorder public/private methods * sort exports alphabetically in util/index.js * fix a couple of typos --- js/src/base-component.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'js/src/base-component.js') diff --git a/js/src/base-component.js b/js/src/base-component.js index fb33d7b0c..3c5eb460a 100644 --- a/js/src/base-component.js +++ b/js/src/base-component.js @@ -13,13 +13,15 @@ import { import EventHandler from './dom/event-handler' /** - * ------------------------------------------------------------------------ * Constants - * ------------------------------------------------------------------------ */ const VERSION = '5.1.3' +/** + * Class definition + */ + class BaseComponent { constructor(element) { element = getElement(element) @@ -32,6 +34,7 @@ class BaseComponent { Data.set(this._element, this.constructor.DATA_KEY, this) } + // Public dispose() { Data.remove(this._element, this.constructor.DATA_KEY) EventHandler.off(this._element, this.constructor.EVENT_KEY) @@ -45,8 +48,7 @@ class BaseComponent { executeAfterTransition(callback, element, isAnimated) } - /** Static */ - + // Static static getInstance(element) { return Data.get(getElement(element), this.DATA_KEY) } @@ -60,7 +62,7 @@ class BaseComponent { } static get NAME() { - throw new Error('You have to implement the static method "NAME", for each component!') + throw new Error('You have to implement the static method "NAME" for each component!') } static get DATA_KEY() { -- cgit v1.2.3