Skip to content

Performance improvements

Compare
Choose a tag to compare
@lpinca lpinca released this 09 Sep 12:11
· 170 commits to master since this release

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 }
});