Skip to content

Releases: primus/eventemitter3

3.1.2

30 Apr 05:02
Compare
Choose a tag to compare

Bug fixes

  • Revert "[ts] Improve ListenerFn interface (#193)" (0843125).

3.1.1

29 Apr 16:30
Compare
Choose a tag to compare

Bug fixes

  • The ListenerFn interface has been updated to support async functions (#193).

3.1.0

25 Apr 19:53
Compare
Choose a tag to compare

Features

  • A source map is now included in the umd folder of the npm package (a053f61).
  • TypeScript type definitions have been updated to add the ability to specify
    supported events (#159).

3.0.1

07 Feb 07:54
Compare
Choose a tag to compare

Bug fixes

  • Fixed TypeScript type definitions (#135).

3.0.0

29 Nov 17:18
Compare
Choose a tag to compare

Breaking changes

  • EventEmitter.prototype.listeners() always returns an array. Use EventEmitter.prototype.listenerCount() for existence checking.
  • EventEmitter.prototype.setMaxListeners() has been removed. It was a noop and documented as not supported.
  • Bower and Component are no longer supported.

Features

  • Added EventEmitter.prototype.listenerCount().

UMD bundle

31 Mar 14:50
Compare
Choose a tag to compare

The npm package now contains a minified UMD bundle.

TypeScript definitions

30 Sep 06:36
Compare
Choose a tag to compare

This release ships with TypeScript type definitions. Thanks to @delta62, @Stubb0rn, and @roblav96 who helped making this release possible!

ES6 import

27 Sep 06:45
Compare
Choose a tag to compare

This release comes with a minor fix that allows EventEmitter to be imported as module namespace in ES6-compatible environments.

import { EventEmitter } from 'eventemitter3';

Performance improvements

09 Sep 12:11
Compare
Choose a tag to compare

This release comes with some nice optimizations which make 2.0.0 our fastest release ever. If you are curious you can see the results of our benchmarks here: https://github.com/primus/eventemitter3/blob/master/benchmarks/README.md.

Breaking changes

The reason for the major version bump is that there is a small breaking change.
With eventemitter3@<2.0.0 you could inherit from the EventEmitter class without calling the super constructor.

var EventEmitter = require('eventemitter3');

function MyEmitter() {}

MyEmitter.prototype = Object.create(EventEmitter.prototype, {
  constructor: { value: MyEmitter }
});

With [email protected] this no longer works. Super constructor invocation is required.

var EventEmitter = require('eventemitter3');

function MyEmitter() {
  EventEmitter.call(this);
}

MyEmitter.prototype = Object.create(EventEmitter.prototype, {
  constructor: { value: MyEmitter }
});

eventNames

17 Mar 07:24
Compare
Choose a tag to compare

This release ships with a new method called eventNames. It returns an array listing the events for which the emitter has registered listeners. The values in the array will be strings or Symbols.

const EventEmitter = require('eventemitter3');

const ee = new EventEmitter();

ee.on('foo', () => {});
ee.on('bar', () => {});
ee.on(Symbol('s'), () => {});

console.log(ee.eventNames());
// => [ 'foo', 'bar', Symbol(s) ]