
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
keypress-tool
Advanced tools
˜˜˜js import KeyPress from 'keypress-tool';
// Calling it with the same parameters returns identical objects KeyPress('A', 'ctrl') === KeyPress('A', 'ctrl'); // true KeyPress('A', 'ctrl') === KeyPress('A', 'ctrl', 'shift'); // false
// Add listeners like this KeyPress('A', 'shift').addListener(ev => { console.log('Key combination pressed'); });
// Set the second parameter to true if this listener should also fire during text input KeyPress('A', 'meta').addListener(handleEvent, true);
function handleEvent(event) { console.log('Key combination pressed'); }
// Clean up (very important to avoid memory leaks) KeyPress('A', 'meta').removeListener(handleEvent);
// The default is to preventDefault. Pass 'executeDefault' if you want to change this KeyPress('A', 'executeDefault');
// Generate a short description of the key combination let k = KeyPress('A', 'ctrl', 'shift', 'alt', 'meta'); k.toString(); // 'Win+Ctrl+Alt+Shift+A' on most platforms k.toString(); // '⌃⌥⇧⌘A' on macOS ˜˜˜
Only these special keys work in fullscreen in Safari:
Tab, Enter, Space, Left, Up, Right, Down, ; = , - . / \` \[ \] '
See also:
Download source and compile:
˜˜˜sh git clone git@github.com:JannesMeyer/keypress-tool.git yarn ˜˜˜
Or compile and watch for file changes:
˜˜˜sh yarn start ˜˜˜
Run tests:
˜˜˜sh yarn test ˜˜˜
Please respect the existing formatting and indentation style. Please add tests for code that you contribute. Submit a pull request when you are done.
FAQs
Create custom keyboard shortcuts (in the browser)
The npm package keypress-tool receives a total of 12 weekly downloads. As such, keypress-tool popularity was classified as not popular.
We found that keypress-tool 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.