Created
July 28, 2025 07:38
-
-
Save pongo/07de1a81b68492004cba6bbc3d4afddc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function prevent<T extends unknown[], R>(listener: (event: KeyboardEvent, ...rest: T) => R) { | |
return (event: KeyboardEvent, ...rest: T) => { | |
event.preventDefault(); | |
event.stopPropagation(); | |
return listener(event, ...rest); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment