Releases: primus/eventemitter3
EventEmitter.prefixed
We added a minor feature in this release.
The EventEmitter
constructor now has a prefixed
property which lets you know what is the character used to prefix the event names. This property is set to false when Object.create()
is available.
var prefix = require('eventemitter3').prefixed;
console.log(prefix);
Restore performances
This release brings back the performances of version 0.1.6
without sacrificing features and safety.
Symbols
Breaking changes
The way we export the module is changed. For legacy reasons we also supported .EventEmitter
property on the returned eventemitter3
object but this has been completely removed. So your previous:
var EventEmitter = require('eventemitter3').EventEmitter;
Should be changed to:
var EventEmitter = require('eventemitter3');
In addition to that we've made a breaking change the internal argument order of the removeListener
api. Historically we used the third argument as indication that only once
listeners but we've changed to allow the third argument to be used as context
argument as we could also remove listeners based on the context.
Other than that, we added support for a second argument in the listeners
API. Happy hacking.
Context and Fixes
First, a new feature. I've added support for context based emits by adding a third context param to on
and once
as illustrated by this example:
var e = new EventEmitter();
e.on('event', function () {
this === context
}, context);
In addition to that, I've detected a critical bug that cause the complete events object to be erased when one of the events was added using .once.