1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-26 21:39:08 +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

@@ -21,6 +21,7 @@ import Data from './dom/data'
import EventHandler from './dom/event-handler'
import Manipulator from './dom/manipulator'
import SelectorEngine from './dom/selector-engine'
import BaseComponent from './base-component'
/**
* ------------------------------------------------------------------------
@@ -104,8 +105,10 @@ const PointerType = {
* Class Definition
* ------------------------------------------------------------------------
*/
class Carousel {
class Carousel extends BaseComponent {
constructor(element, config) {
super(element)
this._items = null
this._interval = null
this._activeElement = null
@@ -116,7 +119,6 @@ class Carousel {
this.touchDeltaX = 0
this._config = this._getConfig(config)
this._element = element
this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
this._pointerEvent = Boolean(window.PointerEvent)
@@ -135,6 +137,10 @@ class Carousel {
return Default
}
static get DATA_KEY() {
return DATA_KEY
}
// Public
next() {
@@ -590,10 +596,6 @@ class Carousel {
event.preventDefault()
}
static getInstance(element) {
return Data.getData(element, DATA_KEY)
}
}
/**