diff options
| author | Johann-S <[email protected]> | 2019-09-04 17:58:29 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-11-29 20:58:26 +0200 |
| commit | 9f6b342dc710e4334b37ded90136efa1127a47cd (patch) | |
| tree | cb5d8c8bddf356dd3f8c2289b99e9f9793fba6c7 /js/src/carousel.js | |
| parent | c63aebc86ba05f0ebb420add653b80804c6a0cff (diff) | |
| download | bootstrap-9f6b342dc710e4334b37ded90136efa1127a47cd.tar.xz bootstrap-9f6b342dc710e4334b37ded90136efa1127a47cd.zip | |
create a base component
Diffstat (limited to 'js/src/carousel.js')
| -rw-r--r-- | js/src/carousel.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index c663efbea..6a035c9ab 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -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) - } } /** |
