Fix issue with click_outside where non-function types could be stored as callbacks
This commit is contained in:
parent
26648bde73
commit
7d31536014
|
@ -79,7 +79,8 @@ const removeHandler = id => {
|
||||||
export default (element, opts) => {
|
export default (element, opts) => {
|
||||||
const id = Math.random()
|
const id = Math.random()
|
||||||
const update = newOpts => {
|
const update = newOpts => {
|
||||||
const callback = newOpts?.callback || newOpts
|
const callback =
|
||||||
|
newOpts?.callback || (typeof newOpts === "function" ? newOpts : null)
|
||||||
const anchor = newOpts?.anchor || element
|
const anchor = newOpts?.anchor || element
|
||||||
const allowedType = newOpts?.allowedType || "click"
|
const allowedType = newOpts?.allowedType || "click"
|
||||||
updateHandler(id, element, anchor, callback, allowedType)
|
updateHandler(id, element, anchor, callback, allowedType)
|
||||||
|
|
Loading…
Reference in New Issue