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:
authorJohann-S <johann.servoire@gmail.com>2015-09-16 11:35:29 +0300
committerJohann-S <johann.servoire@gmail.com>2015-10-02 11:01:24 +0300
commit21a65f181eebc3f2c0cd43fb3383ee3de673745b (patch)
tree72a1c5e6da10a3dd7c918e05d0eff6a4d8e0c0aa /js/src/carousel.js
parentc34fdd415e864e5e6a64f36a0278b5d43c15d3a2 (diff)
Add throw error for undefined method on plugins
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r--js/src/carousel.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index efacd9494e..d8da854a22 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -390,10 +390,11 @@ const Carousel = (($) => {
if (typeof config === 'number') {
data.to(config)
-
- } else if (action) {
+ } else if (typeof action === 'string') {
+ if (data[action] === undefined) {
+ throw new Error(`No method named "${action}"`)
+ }
data[action]()
-
} else if (_config.interval) {
data.pause()
data.cycle()