mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
web/util: fix focus event
This commit is contained in:
parent
0bbb84c6d1
commit
1ad5a14d0f
1 changed files with 1 additions and 1 deletions
|
@ -17,7 +17,7 @@ import { NonNullCachedEventDispatcher, useNonNullEventAsState } from "@/util/eve
|
|||
|
||||
const focused = new NonNullCachedEventDispatcher(document.hasFocus())
|
||||
window.addEventListener("focus", () => focused.emit(true))
|
||||
window.addEventListener("blur", () => focused.emit(true))
|
||||
window.addEventListener("blur", () => focused.emit(false))
|
||||
|
||||
export default function useFocus() {
|
||||
return useNonNullEventAsState(focused)
|
||||
|
|
Loading…
Add table
Reference in a new issue