aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'js/src')
-rw-r--r--js/src/carousel.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index ea258527d..afe02f5b7 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -442,17 +442,21 @@ class Carousel extends BaseComponent {
}
}
- const action = typeof config === 'string' ? config : _config.slide
-
if (typeof config === 'number') {
data.to(config)
- } else if (typeof action === 'string') {
- if (typeof data[action] === 'undefined') {
- throw new TypeError(`No method named "${action}"`)
+ return
+ }
+
+ if (typeof config === 'string') {
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
+ throw new TypeError(`No method named "${config}"`)
}
- data[action]()
- } else if (_config.interval && _config.ride) {
+ data[config]()
+ return
+ }
+
+ if (_config.interval && _config.ride) {
data.pause()
data.cycle()
}