
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.
Register clickout event in javascript
npm install clickout --save
import ClickOut from 'clickout';
export default class ClickOut {
// Emit a 'clickout' event each time you click outside of a specific HTMLElement
static bindCustomEvent(element: string | HTMLElement): destroyClickOut;
// Trigger a function only when you click outside of a specific HTMLElement
static bind(element: string | HTMLElement, onClickOut: onCLickOut): destroyClickOut;
// Destroy all listeners for emit/trigger clickout event/function
static destroy(element: string | HTMLElement): void;
}
CustomEvent is supported in all major browsers. If you need support for old browsers check this polyfill.
const element = document.querySelector('#myElement');
// Emit 'clickout' event when you click outside of element
ClickOut.bindCustomEvent(element);
// Listen on 'clickout' event emitted from the element
element.addEventListener('clickout', (e) => {
console.log(`You clicked an element outside of ${e.target}`);
})
// elsewhere on your code
element.addEventListener('clickout', (e) => {
console.log(`I'm triggered too on clickout ${e.target}!`)
})
const element = document.querySelector('#myElement');
// Trigger a function only when you click outside of a specific HTMLElement
ClickOut.bind(element, (e) => {
console.log(`You clicked ${e.target} and it's out of ${element}`)
});
const element = document.querySelector('#myElement');
ClickOut.bindCustomEvent(element);
element.addEventListener('clickout', (e) => {
console.log(`You clicked an element outside of ${e.target}`);
});
ClickOut.destroy(element);
/**
* ------------------------------
* Is the same as:
*/
const destroyClickOutElement = ClickOut.bindCustomEvent(element);
element.addEventListener('clickout', (e) => {
console.log(`You clicked an element outside of ${e.target}`);
});
destroyClickOutElement();
const element = document.querySelector('#myElement');
ClickOut.bind(element, (e) => {
console.log(`You clicked ${e.target} and it's out of ${element}`)
});
ClickOut.destroy(element);
/**
* ------------------------------
* Is the same as:
*/
const destroyClickOutElement = ClickOut.bind(element, (e) => {
console.log(`You clicked ${e.target} and it's out of ${element}`)
});
destroyClickOutElement();
FAQs
Register clickout event in javascript
We found that clickout 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
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.