Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
usekey-event-manager
Advanced tools
Readme
🔑 Easily map window listeners to keyboard events in React
useKey
is a custom React hook, so you're project must be running React and ReactDOM versions 16.8+
.
To install, use your package manager of choice. Here is the command for npm:
npm i usekey-event-manager
Import useKey
from usekey-event-manager
and pass it a keyboard event map:
import React from 'react'
import useKey from 'usekey-event-manager'
function Dialog(props) {
useKey({ Escape: props.closeAndReturnFocus })
return(
<div role="alertdialog">
{/* ... */}
</div>
)
}
export default Dialog
Version 1+ of usekey-event-manager
comprises a single export: useKey
.
useKey()
useKey
is a custom React hook that assigns a window event listener on keydown. When an event is fired, the listener compares it to a set of selected keys, then calls the action and passes the event object if there is a match.
useKey(Object<String, Function>)
If there is a single key that you want to listen for, you can pass a map like so:
useKey({ Escape: close })
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
FAQs
Easily map window listeners to keyboard events in React
We found that usekey-event-manager 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.
Research
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.