Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/util/swipe.js')
-rw-r--r--js/src/util/swipe.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/util/swipe.js b/js/src/util/swipe.js
index a78f598d9d..87a5f7f5ae 100644
--- a/js/src/util/swipe.js
+++ b/js/src/util/swipe.js
@@ -1,6 +1,17 @@
+/**
+ * --------------------------------------------------------------------------
+ * Bootstrap (v5.1.3): util/swipe.js
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
+ * --------------------------------------------------------------------------
+ */
+
import EventHandler from '../dom/event-handler'
import { execute, typeCheckConfig } from './index'
+/**
+ * Constants
+ */
+
const NAME = 'swipe'
const EVENT_KEY = '.bs.swipe'
const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`
@@ -25,6 +36,10 @@ const DefaultType = {
endCallback: '(function|null)'
}
+/**
+ * Class definition
+ */
+
class Swipe {
constructor(element, config) {
this._element = element
@@ -39,10 +54,12 @@ class Swipe {
this._initEvents()
}
+ // Public
dispose() {
EventHandler.off(this._element, EVENT_KEY)
}
+ // Private
_start(event) {
if (!this._supportPointerEvents) {
this._deltaX = event.touches[0].clientX
@@ -114,6 +131,7 @@ class Swipe {
return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
}
+ // Static
static isSupported() {
return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
}