
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A lightweight, zero-dependency keyboard shortcut binding utility for web applications. Easy Bind provides a simple API to bind and manage keyboard shortcuts in your browser applications.
npm install easy-bind
yarn add easy-bind
pnpm add easy-bind
<script type="module">
import { bindShortcut, startListening } from 'https://unpkg.com/easy-bind/dist/index.js';
</script>
import { bindShortcut, startListening } from 'easy-bind';
// Start listening for keyboard events
startListening();
// Bind a simple shortcut
bindShortcut('ctrl+s', (event) => {
console.log('Save shortcut triggered!');
event.preventDefault();
});
// Bind a complex shortcut
bindShortcut('ctrl+shift+n', (event) => {
console.log('New file shortcut triggered!');
});
startListening()Starts listening for keyboard events. Must be called before any shortcuts will work.
import { startListening } from 'easy-bind';
startListening();
stopListening()Stops listening for keyboard events and removes all event listeners.
import { stopListening } from 'easy-bind';
stopListening();
bindShortcut(combo, callback, options?)Binds a keyboard shortcut to a callback function.
Parameters:
combo (string): The key combination (e.g., 'ctrl+s', 'alt+shift+f')callback (function): Function to execute when shortcut is triggeredoptions (object, optional): Configuration optionsimport { bindShortcut } from 'easy-bind';
bindShortcut('ctrl+s', (event) => {
console.log('Save triggered');
}, { preventDefault: true });
unbindShortcut(combo)Removes a keyboard shortcut binding.
import { unbindShortcut } from 'easy-bind';
unbindShortcut('ctrl+s');
ShortcutOptionsinterface ShortcutOptions {
preventDefault?: boolean; // Prevent default browser behavior
}
ctrl - Control keycmd - Command key (Mac) / Windows keyalt - Alt/Option keyshift - Shift keya, b, c, ..., z0, 1, 2, ..., 9f1, f2, ..., f12enter, escape, tab, space, backspace, deletearrowup, arrowdown, arrowleft, arrowrighthome, end, pageup, pagedown;, =, ,, -, ., /, `, [, \, ], 'numpad0-numpad9, numpadadd, numpadsubtract, etc.import { bindShortcut, startListening } from 'easy-bind';
startListening();
// Save shortcut
bindShortcut('ctrl+s', (event) => {
event.preventDefault();
saveDocument();
});
// Copy shortcut
bindShortcut('ctrl+c', (event) => {
copyToClipboard();
});
// Undo shortcut
bindShortcut('ctrl+z', (event) => {
event.preventDefault();
undo();
});
// Multiple modifiers
bindShortcut('ctrl+shift+s', (event) => {
saveAs();
});
// Three modifiers
bindShortcut('ctrl+alt+shift+r', (event) => {
restartApplication();
});
bindShortcut('ctrl+s', (event) => {
saveDocument();
}, {
preventDefault: true // Prevents browser's default save dialog
});
// Bind shortcuts dynamically
function setupShortcuts() {
bindShortcut('ctrl+n', createNewFile);
bindShortcut('ctrl+o', openFile);
bindShortcut('ctrl+w', closeFile);
}
// Remove shortcuts when needed
function cleanupShortcuts() {
unbindShortcut('ctrl+n');
unbindShortcut('ctrl+o');
unbindShortcut('ctrl+w');
}
import React, { useEffect } from 'react';
import { bindShortcut, unbindShortcut, startListening } from 'easy-bind';
function MyComponent() {
useEffect(() => {
startListening();
const handleSave = (event) => {
event.preventDefault();
// Save logic here
};
bindShortcut('ctrl+s', handleSave);
return () => {
unbindShortcut('ctrl+s');
};
}, []);
return <div>My Component</div>;
}
<template>
<div>My Component</div>
</template>
<script>
import { bindShortcut, unbindShortcut, startListening } from 'easy-bind';
export default {
mounted() {
startListening();
bindShortcut('ctrl+s', this.handleSave);
},
beforeUnmount() {
unbindShortcut('ctrl+s');
},
methods: {
handleSave(event) {
event.preventDefault();
// Save logic here
}
}
}
</script>
Easy Bind works in all modern browsers that support:
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
Lightweight keyboard shortcut binding utility
The npm package easy-bind receives a total of 0 weekly downloads. As such, easy-bind popularity was classified as not popular.
We found that easy-bind demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.