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

ev-emitter

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ev-emitter

lil' event emitter

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is ev-emitter?

The ev-emitter package is a simple event emitter library for JavaScript. It allows you to add event-driven architecture to your applications by providing methods to emit events and listen for them.

What are ev-emitter's main functionalities?

Add Event Listener

This feature allows you to add an event listener for a specific event. In the code sample, an event listener is added for the 'event' event, and when the event is emitted, the callback function `onEvent` is executed.

const EvEmitter = require('ev-emitter');
const emitter = new EvEmitter();

function onEvent() {
  console.log('Event triggered!');
}

emitter.on('event', onEvent);
emitter.emitEvent('event');

Remove Event Listener

This feature allows you to remove an event listener for a specific event. In the code sample, the event listener for the 'event' event is removed before the event is emitted, so the callback function `onEvent` is not executed.

const EvEmitter = require('ev-emitter');
const emitter = new EvEmitter();

function onEvent() {
  console.log('Event triggered!');
}

emitter.on('event', onEvent);
emitter.off('event', onEvent);
emitter.emitEvent('event');

Emit Event

This feature allows you to emit an event, triggering all the listeners that are registered for that event. In the code sample, the 'event' event is emitted, and the callback function `onEvent` is executed.

const EvEmitter = require('ev-emitter');
const emitter = new EvEmitter();

function onEvent() {
  console.log('Event triggered!');
}

emitter.on('event', onEvent);
emitter.emitEvent('event');

Other packages similar to ev-emitter

Keywords

FAQs

Package last updated on 07 Jan 2016

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