Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
jwerty-globals-fixed
Advanced tools
![Gitter](https://badges.gitter.im/Join Chat.svg)
jwerty is a JS lib which allows you to bind, fire and assert key combination strings against elements and events. It normalises the poor std api into something easy to use and clear.
jwerty is a small library, weighing in at around 1.5kb bytes minified and gzipped (~3kb minified). jwerty has no dependencies, but is compatible with jQuery, Zepto, Ender or CanJS if you include those packages alongside it. You can install jwerty via npm (for use with Ender) or Bower.
For detailed docs, please read the README-DETAILED.md file.
Use jwerty.key
to bind your callback to a key combo (global shortcuts)
jwerty.key('ctrl+shift+P', function () { [...] });
jwerty.key('⌃+⇧+P', function () { [...] });
Specify optional keys:
jwerty.key('⌃+⇧+P/⌘+⇧+P', function () { [...] });
or key sequences:
jwerty.key('↑,↑,↓,↓,←,→,←,→,B,A,↩', function () { [...] });
You can also (since 0.3) specify regex-like ranges:
jwerty.key('ctrl+[a-c]', function () { [...] }); // fires for ctrl+a,ctrl+b or ctrl+c
Pass in a context to bind your callback:
jwerty.key('⌃+⇧+P/⌘+⇧+P', function () { [...] }, this);
Pass in a selector to bind a shortcut local to that element:
jwerty.key('⌃+⇧+P/⌘+⇧+P', function () { [...] }, this, '#myinput');
Pass in a selector's context, similar to jQuery's $('selector', 'scope'):
jwerty.key('⌃+⇧+P/⌘+⇧+P', function () { [...] }, this, 'input.email', '#myForm');
If you're binding to a selector and don't need the context, you can ommit it:
jwerty.key('⌃+⇧+P/⌘+⇧+P', function () { [...] }, 'input.email', '#myForm');
Calls to jwerty.key
return a subscription handle that you can use to disconnect the callback
var h = jwerty.key('ctrl+shift+P', function () { [...] })
h.unbind()
Use jwerty.event
as a decorator, to bind events your own way:
$('#myinput').bind('keydown', jwerty.event('⌃+⇧+P/⌘+⇧+P', function () { [...] }));
Use jwerty.is
to check a keyCombo against a keyboard event:
function (event) {
if ( jwerty.is('⌃+⇧+P', event) ) {
[...]
}
}
Or use jwerty.fire
to send keyboard events to other places:
jwerty.fire('enter', 'input:first-child', '#myForm');
FAQs
Awesome handling of keyboard events
The npm package jwerty-globals-fixed receives a total of 639 weekly downloads. As such, jwerty-globals-fixed popularity was classified as not popular.
We found that jwerty-globals-fixed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.