Add throw error for undefined method on plugins
This commit is contained in:
parent
c34fdd415e
commit
21a65f181e
16 changed files with 121 additions and 4 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -333,6 +333,9 @@ const Collapse = (($) => {
|
|||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined) {
|
||||
throw new Error(`No method named "${config}"`)
|
||||
}
|
||||
data[config]()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -143,6 +143,9 @@ const Dropdown = (($) => {
|
|||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined) {
|
||||
throw new Error(`No method named "${config}"`)
|
||||
}
|
||||
data[config].call(this)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -463,8 +463,10 @@ const Modal = (($) => {
|
|||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined) {
|
||||
throw new Error(`No method named "${config}"`)
|
||||
}
|
||||
data[config](relatedTarget)
|
||||
|
||||
} else if (_config.show) {
|
||||
data.show(relatedTarget)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,6 +153,9 @@ const Popover = (($) => {
|
|||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined) {
|
||||
throw new Error(`No method named "${config}"`)
|
||||
}
|
||||
data[config]()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -277,6 +277,9 @@ const ScrollSpy = (($) => {
|
|||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined) {
|
||||
throw new Error(`No method named "${config}"`)
|
||||
}
|
||||
data[config]()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -234,6 +234,9 @@ const Tab = (($) => {
|
|||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined) {
|
||||
throw new Error(`No method named "${config}"`)
|
||||
}
|
||||
data[config]()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -622,6 +622,9 @@ const Tooltip = (($) => {
|
|||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (data[config] === undefined) {
|
||||
throw new Error(`No method named "${config}"`)
|
||||
}
|
||||
data[config]()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue