blowfish/node_modules/@headlessui/react/dist/hooks/use-document-event.js

2 lines
271 B
JavaScript
Raw Normal View History

2023-01-29 22:30:24 +00:00
import{useEffect as m}from"react";import{useLatestValue as c}from'./use-latest-value.js';function d(e,r,n){let o=c(r);m(()=>{function t(u){o.current(u)}return document.addEventListener(e,t,n),()=>document.removeEventListener(e,t,n)},[e,n])}export{d as useDocumentEvent};