Skip to content

bastienrobert/events

Repository files navigation

Events

Event emitter for all engines

Partially implements the Node.js events module for environments that do not have it, like browsers
Fast & 525B gzipped (because size matters)

Install

npm install @bastienrobert/events

Usage

import EventEmitter from '@bastienrobert/events'

const eventEmitter = new EventEmitter()
eventEmitter.on('foo', bar => {
  console.log(bar)
})
eventEmitter.emit('foo', 'here we go!')

API

See the Documentation. You can check the Node.js EventEmitter docs too, most methods are implemented in this package.