UNPKG

use-keybinds

Version:

Lightweight keybind library for React

3 lines 440 B
"use client" import{useCallback as u,useEffect as s,useState as l}from"react";var c=()=>{let[o,n]=l(typeof window<"u"?document.activeElement:null),e=u(()=>{n(document.activeElement)},[]),t=u(()=>{n(null)},[]);return s(()=>(addEventListener("focusin",e),addEventListener("focusout",t),()=>{removeEventListener("focusin",e),removeEventListener("focusout",t)}),[e,t]),o},m=c;export{m as default}; //# sourceMappingURL=useFocusedElement.mjs.map