fix: add warnings when click delegates return non-booleans (#1319)
This commit is contained in:
parent
cfc182a836
commit
8615c6e4fd
|
@ -28,7 +28,11 @@ function onEvent (e) {
|
|||
return // ignore if the user is selecting text inside the clickable area
|
||||
}
|
||||
}
|
||||
if (callbacks[key](e)) { // callback returns true to indicate it has handled the action
|
||||
let res = callbacks[key](e) // callback returns true to indicate it has handled the action
|
||||
if (process.env.NODE_ENV !== 'production' && typeof res !== 'boolean') {
|
||||
console.warn(`Callback returned a non-boolean response: "${key}". This should never happen.`)
|
||||
}
|
||||
if (res) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue