
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
react-outside-event
Advanced tools
A higher order React component that attaches an event listener for events that occur outside of the component element.
A higher order React component that attaches an event listener for events that occur outside of the component element.
All DOM events that bubble are supported. By default, only "mousedown" event listener is attached. See supportedEvents parameter of the ReactOutsideEvent function.
/**
* @param {ReactClass} Target The component that defines `onOutsideEvent` handler.
* @param {String[]} supportedEvents A list of valid DOM event names. Default: ['mousedown'].
* @return {ReactClass}
*/
Define a component class and wrap it using ReactOutsideEvent. Your class must define onOutsideEvent method that will be invoked when an outside event occurs, e.g.
import React from 'react';
import ReactDOM from 'react-dom';
import ReactOutsideEvent from 'react-outside-event';
class Player extends React.Component {
onOutsideEvent = (event) => {
// Handle the event.
}
render () {
return <div>Hello, World!</div>;
}
}
export default ReactOutsideEvent(Player, ['click']);
You can attach multiple event listeners at once and selectively handle events with a simple conditional logic, e.g.
import React from 'react';
import ReactDOM from 'react-dom';
import ReactOutsideEvent from 'react-outside-event';
class Player extends React.Component {
onOutsideEvent = (event) => {
if (event.type === 'mousedown') {
} else if (event.type === 'mouseup') {
}
}
render () {
return <div>Hello, World!</div>;
}
}
export default ReactOutsideEvent(Player, ['mousedown', 'mouseup']);
npm run lint
npm run test
npm run build
npm run build
npm run start
FAQs
A higher order React component that attaches an event listener for events that occur outside of the component element.
The npm package react-outside-event receives a total of 378 weekly downloads. As such, react-outside-event popularity was classified as not popular.
We found that react-outside-event 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
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.