-
-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(useKeydown): optimize keydown event handling #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
johnleider
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be reading this wrong, but I really thing you might benefit from using useRegistry instead of managing handlerMap.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
commit: |
242bb48 to
24efe46
Compare
|
Looks good but I don't quite understand exporting the handlerMap, what's the use case? |
…lated instances - Implement trinity pattern (createKeydown, createKeydownContext, createKeydownPlugin) - Move document listener inside each instance for proper isolation - Remove module-level global state (globalListener, handlerRegistry) - Update useKeydown() to consume context instead of accepting handlers directly - Refactor tests to work with new isolated architecture - Update documentation to reflect plugin-first approach and instance isolation Breaking changes: - useKeydown() now returns context instance instead of accepting handlers - Use createKeydown() for standalone instances - Use createKeydownPlugin() for app-level installation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
use registrar and single event listener to listen to keydown in a more performant way