laquasicinque / hotstuff Goto Github PK
View Code? Open in Web Editor NEWSmall Javascript Library, with no dependencies, to add hotkeys to an element
License: MIT License
Small Javascript Library, with no dependencies, to add hotkeys to an element
License: MIT License
when I type the ,
char I get:
Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
at HotStuff.handleKeyDown
Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
at HotStuff.handleKeyUp
from lines:
// perhaps refactor;
var key = (e.which && e.keyCode ? KEYCODE_ALIAS_MAP[e.which || e.keyCode] : e.key).toLowerCase();
google chrome
Generic key listeners trigger fine on key down, but only listen to one key up event (as it's removed after the first key is released).
Not only this but events caused my key down events should probably affect the correct key up event (e.g triggering a keydown event for e
and having it return false should make it so that when e
is released, no key up function is called.
Add the ability to provide hotkeys that accept a generic structure. Something like ctrl-<key>
would listen to any keypresses that consist of ctrl and a key
At the moment, when the window loses focus, all active keys are marked as released (dropped from the array). It does not, however, trigger the events of all the keyups.
We do have access to all the handlers that need to be triggered, however for them to be triggered correctly we need to provide each handler a KeyboardEvent
object.
This object needs to contain fake, simulated, but accurate data, for example
a
the key up event should also be for the character a
ctrl-shift-a
it should be one of the valid characters (perhaps the last one pressed (ie, the one that caused the trigger).ctrl-r
and alt-f
, and was triggered by the former, only ctrl
and f
are the only acceptable values for the key upCurrently, the only way I can think of doing this is storing the keydown event and using it to make a simulated keyup event (if not using the same object and changing the timestamp and eventtype)
This is my biggest hurdle with the library.
When I do eg. meta+up
(command+up on mac) it listens once, and also on more strokes of the up-key, but once I let go the command key, hotstuff stops listening completely to anything.
I wasn't able to reproduce this on Codepen, so let me know if you want me to show in my app on my screen.
I'm not sure what is meant with the "select" keycode for 93
.
On macOS using the right command key (⌘) triggers 93
but I think this is considered to be the meta
key?
There's a bug with meta and down/up
→ when doing meta+down
successively it works.
→ when doing meta+up
successively it works.
→ when doing meta+down
and afterwards meta+up
it will start logging down+meta+up
instead.
This further also breaks the recognition of the regular up
key logging down
after this bug has occurred.
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.