bring over most of the things

This commit is contained in:
MapleLeaf
2022-01-02 16:35:03 -06:00
committed by Darius
parent aa27623d11
commit 336e680b6e
23 changed files with 738 additions and 76 deletions

View File

@@ -0,0 +1,11 @@
import { useEffect } from "react"
export function useWindowEvent<EventType extends keyof WindowEventMap>(
type: EventType,
handler: (event: WindowEventMap[EventType]) => void,
) {
useEffect(() => {
window.addEventListener(type, handler)
return () => window.removeEventListener(type, handler)
})
}