Skip to content

Commit

Permalink
add _events getter
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 27, 2015
1 parent ac555f1 commit 66518a0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,20 @@ EventEmitter.prototype.listeners = function listeners(type) {
return ret;
};

Object.defineProperty(EventEmitter.prototype, '_events', {
get() {
const thisEvents = this[eventSymbol];
if (!thisEvents)
return;

const events = {};
for (let event of thisEvents.entries()) {
events[event[0]] = event[1];
}
return events;
}
});

EventEmitter.listenerCount = function(emitter, type) {
var evlistener;
var ret = 0;
Expand Down

0 comments on commit 66518a0

Please sign in to comment.