Socket
Socket
Sign inDemoInstall

@antv/event-emitter

Package Overview
Dependencies
Maintainers
57
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/event-emitter

event emitter for antvis.


Version published
Weekly downloads
123K
decreased by-7.67%
Maintainers
57
Weekly downloads
 
Created

What is @antv/event-emitter?

@antv/event-emitter is a lightweight and efficient event emitter library that allows you to create and manage custom events in JavaScript applications. It is part of the AntV visualization suite and is designed to be simple yet powerful, making it easy to integrate event-driven architecture into your projects.

What are @antv/event-emitter's main functionalities?

Event Emission

This feature allows you to emit events with a specific name and optional data payload. The emitted event can then be listened to by any registered listeners.

const EventEmitter = require('@antv/event-emitter');
const emitter = new EventEmitter();
emitter.emit('eventName', { key: 'value' });

Event Listening

This feature allows you to register listeners for specific events. When the event is emitted, the registered listeners are called with the event data.

const EventEmitter = require('@antv/event-emitter');
const emitter = new EventEmitter();
emitter.on('eventName', (data) => {
  console.log('Event received:', data);
});
emitter.emit('eventName', { key: 'value' });

Removing Event Listeners

This feature allows you to remove specific listeners for an event. This is useful for cleaning up and preventing memory leaks in your application.

const EventEmitter = require('@antv/event-emitter');
const emitter = new EventEmitter();
const listener = (data) => {
  console.log('Event received:', data);
};
emitter.on('eventName', listener);
emitter.off('eventName', listener);
emitter.emit('eventName', { key: 'value' });

Other packages similar to @antv/event-emitter

FAQs

Package last updated on 10 Feb 2022

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