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

create a base component

This commit is contained in:
Johann-S
2019-09-04 17:58:29 +03:00
committed by XhmikosR
parent c63aebc86b
commit 9f6b342dc7
23 changed files with 229 additions and 113 deletions

View File

@@ -15,6 +15,7 @@ import {
} from './util/index'
import Data from './dom/data'
import EventHandler from './dom/event-handler'
import BaseComponent from './base-component'
/**
* ------------------------------------------------------------------------
@@ -44,21 +45,17 @@ const CLASSNAME_SHOW = 'show'
* ------------------------------------------------------------------------
*/
class Alert {
constructor(element) {
this._element = element
if (this._element) {
Data.setData(element, DATA_KEY, this)
}
}
class Alert extends BaseComponent {
// Getters
static get VERSION() {
return VERSION
}
static get DATA_KEY() {
return DATA_KEY
}
// Public
close(element) {
@@ -134,10 +131,6 @@ class Alert {
alertInstance.close(this)
}
}
static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
/**