@yamada-ui/use-event-listener
Advanced tools
Comparing version 0.0.0-dev-20230716195657 to 0.0.0-dev-20230718011629
@@ -35,5 +35,13 @@ "use strict"; | ||
return; | ||
el.addEventListener(event, listener, options); | ||
el.addEventListener( | ||
event, | ||
listener, | ||
options | ||
); | ||
return () => { | ||
el.removeEventListener(event, listener, options); | ||
el.removeEventListener( | ||
event, | ||
listener, | ||
options | ||
); | ||
}; | ||
@@ -43,3 +51,7 @@ }, [event, target, options, listener, handler]); | ||
const el = typeof target === "function" ? target() : target != null ? target : document; | ||
el == null ? void 0 : el.removeEventListener(event, listener, options); | ||
el == null ? void 0 : el.removeEventListener( | ||
event, | ||
listener, | ||
options | ||
); | ||
}; | ||
@@ -53,3 +65,7 @@ }; | ||
listeners.current.set(listener, { event, el, options }); | ||
el.addEventListener(event, listener, options); | ||
el.addEventListener( | ||
event, | ||
listener, | ||
options | ||
); | ||
}, | ||
@@ -60,3 +76,7 @@ [] | ||
(el, event, listener, options) => { | ||
el.removeEventListener(event, listener, options); | ||
el.removeEventListener( | ||
event, | ||
listener, | ||
options | ||
); | ||
listeners.current.delete(listener); | ||
@@ -68,3 +88,5 @@ }, | ||
() => () => { | ||
currentListeners.forEach(({ el, event, options }, key) => remove(el, event, key, options)); | ||
currentListeners.forEach( | ||
({ el, event, options }, key) => remove(el, event, key, options) | ||
); | ||
}, | ||
@@ -71,0 +93,0 @@ [remove, currentListeners] |
{ | ||
"name": "@yamada-ui/use-event-listener", | ||
"version": "0.0.0-dev-20230716195657", | ||
"version": "0.0.0-dev-20230718011629", | ||
"description": "Yamada UI useEventListener custom hook", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@yamada-ui/utils": "0.0.0-dev-20230716195657" | ||
"@yamada-ui/utils": "0.0.0-dev-20230718011629" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9653
176
+ Added@yamada-ui/utils@0.0.0-dev-20230718011629(transitive)
- Removed@yamada-ui/utils@0.0.0-dev-20230716195657(transitive)