diff options
| author | GeoSot <[email protected]> | 2021-12-10 18:18:18 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-10 18:18:18 +0200 |
| commit | 886b940796b3595a03b44230ca8b78197c5ee1c5 (patch) | |
| tree | 6b37d0208ae9fd9816e052572ab3496095cc88b6 /js/src/util/swipe.js | |
| parent | 68f226750db03bc26ed5ead6bb074804a4f63853 (diff) | |
| download | bootstrap-886b940796b3595a03b44230ca8b78197c5ee1c5.tar.xz bootstrap-886b940796b3595a03b44230ca8b78197c5ee1c5.zip | |
Extract Component config functionality to a separate class (#33872)
Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/src/util/swipe.js')
| -rw-r--r-- | js/src/util/swipe.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/js/src/util/swipe.js b/js/src/util/swipe.js index 87a5f7f5a..ac09b6fa1 100644 --- a/js/src/util/swipe.js +++ b/js/src/util/swipe.js @@ -5,8 +5,9 @@ * -------------------------------------------------------------------------- */ +import Config from './config' import EventHandler from '../dom/event-handler' -import { execute, typeCheckConfig } from './index' +import { execute } from './index' /** * Constants @@ -40,8 +41,9 @@ const DefaultType = { * Class definition */ -class Swipe { +class Swipe extends Config { constructor(element, config) { + super() this._element = element if (!element || !Swipe.isSupported()) { @@ -54,6 +56,19 @@ class Swipe { this._initEvents() } + // Getters + static get Default() { + return Default + } + + static get DefaultType() { + return DefaultType + } + + static get NAME() { + return NAME + } + // Public dispose() { EventHandler.off(this._element, EVENT_KEY) @@ -118,15 +133,6 @@ class Swipe { } } - _getConfig(config) { - config = { - ...Default, - ...(typeof config === 'object' ? config : {}) - } - typeCheckConfig(NAME, config, DefaultType) - return config - } - _eventIsPointerPenTouch(event) { return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH) } |
