1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-28 22:39:11 +02:00

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
This commit is contained in:
XhmikosR
2021-10-13 15:19:28 +03:00
committed by GitHub
parent db44392bda
commit e8f702666f
21 changed files with 261 additions and 384 deletions

View File

@@ -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() {