imobs / keycap Goto Github PK
View Code? Open in Web Editor NEWTypescript Keypress Bindings for React
License: MIT License
Typescript Keypress Bindings for React
License: MIT License
Add a proper description, some examples, so on. Get some inspiration from similar projects.
The job in the config is there but it's not been tested and nothing has been pushed. It would be nice to have something out there to at least reserve the name.
If a class component has multiple decorators maybe it should be a little smarter about setting up the lifecycle methods once. This might require decoupling the options.
Currently, the keys are being passed into registerCallback
as an array of strings and are being stored as-is. These aren't easy to filter or match on and should be passed through parseKeys
to get an array of KeySet
values.
Currently, the expectation is that the keys be provided through the API as an array of strings for each possible combination. Other similar libraries instead take a comma-separated string that is then split for each of the combinations. Maybe it's worth seeing how that would look.
Right now in keydownListener
it is iterating through everything in instanceMap
which means that every registered callback is fired off. This needs to filter to only those that have a matching key.
Followup: Filtering all registered callbacks every time a keydown event happens is an O(n) operation and there might not be any callbacks that match, which is a whole lot of wasted work. The idea would be to first convert instanceMap
to be a hash map where the KeySet (or something similar) is the key and the value is the list of registered callbacks. Then when a keydown event does occur we convert the KeyboardEvent to a matching KeySet value and then use that to get the list of callbacks in O(1) time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.