JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16644
  • Score
    100M100P100Q171454F
  • License ISC

A modern and lightweight EventEmitter implementation.

Package Exports

  • @xmpp/events

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xmpp/events) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

events

A modern and lightweight EventEmitter implementation.

Install

npm install @xmpp/events

Differences with Node.js EventEmitter

size

@xmpp/events 2KB
Node.js EventEmitter 9KB

@xmpp/events is much smaller but doesn't implement:

  • max listeners
  • listeners ordering
  • eventNames()

promise

emitter.promise(event)
  .then(console.log)
  .catch(console.error)

Returns a promise that resolves when event is emitted and rejects when error is emitted.

off

emitter.off('event', listener)

A simple alias to .removeListener().