Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

consolidated-events

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consolidated-events

Manage multiple event handlers using few event listeners

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
710K
increased by7.66%
Maintainers
1
Weekly downloads
 
Created

What is consolidated-events?

The consolidated-events npm package is designed to optimize event handling in web applications. It allows developers to add event listeners that are automatically consolidated, reducing the number of separate event listeners that need to be managed and improving performance, especially in scenarios with many event listeners.

What are consolidated-events's main functionalities?

Add consolidated event listener

This feature allows you to add an event listener to an element, which will be consolidated with other listeners for the same event type, improving performance.

import { addEventListener } from 'consolidated-events';

const listener = event => console.log('Event fired:', event);
const options = { passive: true, capture: false };
const removeEventListener = addEventListener(window, 'resize', listener, options);

Remove consolidated event listener

This feature provides a way to remove a previously added consolidated event listener, ensuring that the listener is properly cleaned up and does not cause memory leaks.

import { addEventListener } from 'consolidated-events';

const listener = event => console.log('Event fired:', event);
const options = { passive: true, capture: false };
const removeEventListener = addEventListener(window, 'resize', listener, options);

// Later, when you want to remove the event listener:
removeEventListener();

Other packages similar to consolidated-events

Keywords

FAQs

Package last updated on 18 Jun 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc