
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
add-keyup-events
Advanced tools
Emit custom events from an input so you can do stuff like listening for "enter" and "esc" events the same way as you would "keyup".
Takes an element, usually an <input>
or <textarea>
and registers a keyup
handler on it that emits named events for special keys. It does enter
and esc
events by default.
You can override the events by passing an optional second argument that follows the format: {keyvalue: 'customEventName'}
.
npm install add-keyup-events
var addKeyupEvents = require('add-keyup-events');
// some input
var input = document.create('input');
// pass it our input
addKeyupEvents(input);
// Now we can listen for "enter" and "esc" events using the
// normal `addEventListener` the browser gives us.
input.addEventListener('enter', doSomething, false);
You can also override the events to listen for whatever you want.
// some input
var input = document.create('input');
// create a custom hash of keycode to event name mappings:
var customEvents = {
65: 'a',
12: 'enter'
};
// pass it our input, and our custom events
addKeyupEvents(input, customEvents);
// now we can listen for 'a' events and 'enter' events
input.addEventListener('a', doSomething, false);
If you like this, follow @HenrikJoreteg on twitter and check out my book: Human JavaScript.
MIT
FAQs
Emit custom events from an input so you can do stuff like listening for "enter" and "esc" events the same way as you would "keyup".
The npm package add-keyup-events receives a total of 2 weekly downloads. As such, add-keyup-events popularity was classified as not popular.
We found that add-keyup-events 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.