useWindowsFocus
使用 window.onfocus
and window.onblur
事件跟踪页面焦点
Usage
实时编辑器
function Demo() { const focus = useWindowsFocus(); return ( <div> <p> {focus ? "💡 Click somewhere outside of the document to unfocus." : "ℹ Tab is unfocused"} </p> </div> ); };
结果
Loading...