1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +12:00

Fix issue with click_outside where non-function types could be stored as callbacks

This commit is contained in:
Andrew Kingston 2024-03-21 12:08:24 +00:00
parent 26648bde73
commit 7d31536014

View file

@ -79,7 +79,8 @@ const removeHandler = id => {
export default (element, opts) => {
const id = Math.random()
const update = newOpts => {
const callback = newOpts?.callback || newOpts
const callback =
newOpts?.callback || (typeof newOpts === "function" ? newOpts : null)
const anchor = newOpts?.anchor || element
const allowedType = newOpts?.allowedType || "click"
updateHandler(id, element, anchor, callback, allowedType)