piranha / keymage Goto Github PK
View Code? Open in Web Editor NEWYet Another JS Keybinding library
License: ISC License
Yet Another JS Keybinding library
License: ISC License
The code mentions some weird modifier called alt
. For those of us still using emacs, this is an insult.
Please rename to meta
so that it works cross-platform (TM).
In some occasions, it's desired to be able to attach to the keypress
event instead of keydown
, especially since some special character combinations are not consistent across devices.
I guess the consistent place to define this in keymage
would be the options object.
Make tests run under phantomjs. wru supports that, but how do I have single file with tests running in both phantomjs and regular browser?
It would be great if keymage
was published to NPM so Browserify can easily fetch the files.
Is there a way to unbind key events.
I looked into the tests and the code but didn't found anything.
Is it even possible?
I found this on reddit. Keymage is a really neat tool. I was testing this out and noticed that 'defmod-j c', which you have for the index.html does not work on my browser. Ctrl + J is the native hotkey for downloads and when using that key combination it opens the downloads tab on chrome.
Keymage does work on single combinations modifier + key (e.g. ctrl-q) and it does properly executes preventDefault. When testing ctrl-j on the dummy index.html it does override the opening of the downloads tab.
Andrew
Google Chrome 23.0.1271.95 (Official Build 169798) m
OS Windows
WebKit 537.11 (@135931)
JavaScript V8 3.13.7.5
Flash 11.5.31.2
User Agent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11
I'm trying to replace combokeys with keymage
in a project, since it's considerably smaller when not minified (minfied as well, OFC). However, to support the use case, keymage would need to attach to a specific DOM element and not window
, and additionally support cleaning up.
Implementation should be fairly easy, it's mainly a question of what the new API should be and if this is a desired feature(?). Some solutions that come to mind will probably break existing code that assumes keymage
would be attached to the window and immediately available.
It's a increasingly popular pattern to return an undo/unbind function as a result to a do/bind function call.
var unbindOk = keymage("o k", ...);
// Later
unbindOk();
The unbindOk
also acts as a reflectional variable to verify whether the binding has happened before, for example to prevent duplicate bindings.
According to MDN, we should most definitely not be using the .keyCode property. It is deprecated:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
On W3 school, this fact is played down and there is only a side note saying that .keyCode is provided for compatibility only and that the latest version of the DOM Events Specification recommend using the .key property instead.
Will this library be updated to use KeyboardEvent.key?
Thanks
Hi there, can you tag the latest commit? So we could add keymage to cdnjs. Thanks!
Currently it's not possible to bind listener for modifier keys only like:
keymage('shift', () => { console.log('Whoa!'); }
Is there an easy way to globally disable keymage while an INPUT or TEXTAREA is focused?
Hey, nice library! It would be really cool if I could use this with chjj/blessed, which as you may know is a TUI library like ncurses. Is there any way to change the key listener backend to something other than the browser?
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.