Get started with eventemitter3 CDN

MIT licensed

EventEmitter3 is a flexible event handling library for Node.js applications.

Tags:
  • EventEmitter
  • EventEmitter2
  • EventEmitter3
  • Events
  • addEventListener
  • addListener
  • emit
  • emits
  • emitter
  • event
  • once
  • pub/sub
  • publish
  • reactor
  • subscribe

Stable version

Copied!

How to start using eventemitter3 CDN


// Include eventemitter3 library from CDN
const EventEmitter = require('eventemitter3').default;

// Create an instance of EventEmitter
const myEmitter = new EventEmitter();

// Listen for an event with a specific name and callback function
myEmitter.on('myEvent', (data) => {
  console.log('Received event: myEvent, data:', data);
});

// Emit an event with a name and data
myEmitter.emit('myEvent', 'Hello, World!');
Copied!
Copied!

All versions