mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-25 21:09:06 +02:00
create a base component
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
import Data from './dom/data'
|
||||
import EventHandler from './dom/event-handler'
|
||||
import Manipulator from './dom/manipulator'
|
||||
import BaseComponent from './base-component'
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
@@ -60,9 +61,10 @@ const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]'
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
class Toast {
|
||||
class Toast extends BaseComponent {
|
||||
constructor(element, config) {
|
||||
this._element = element
|
||||
super(element)
|
||||
|
||||
this._config = this._getConfig(config)
|
||||
this._timeout = null
|
||||
this._setListeners()
|
||||
@@ -83,6 +85,10 @@ class Toast {
|
||||
return Default
|
||||
}
|
||||
|
||||
static get DATA_KEY() {
|
||||
return DATA_KEY
|
||||
}
|
||||
|
||||
// Public
|
||||
|
||||
show() {
|
||||
@@ -208,10 +214,6 @@ class Toast {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static getInstance(element) {
|
||||
return Data.getData(element, DATA_KEY)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user