diff options
author | XhmikosR <xhmikosr@gmail.com> | 2021-10-13 15:19:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 15:19:28 +0300 |
commit | e8f702666f285a3e69866ed1f8d29fa6eaaaeabb (patch) | |
tree | 944b2dc894f49f8278d41d096e4388e9ac83157b /js/src/base-component.js | |
parent | db44392bda22f3d5319d2880c992f76d27d2a60c (diff) |
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
Diffstat (limited to 'js/src/base-component.js')
-rw-r--r-- | js/src/base-component.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/js/src/base-component.js b/js/src/base-component.js index fb33d7b0cd..3c5eb460ab 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() { |