Skip to content

Commit

Permalink
events: deprecate require('events').EventEmitter
Browse files Browse the repository at this point in the history
recommend developers to use `require('events')`.
  • Loading branch information
JacksonTian committed Jan 15, 2016
1 parent 043e547 commit 5e67eca
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ function EventEmitter() {
}
module.exports = EventEmitter;

// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
Object.defineProperty(EventEmitter, 'EventEmitter', {
get: internalUtil.deprecate(function() {
return EventEmitter;
},
`require('events').EventEmitter is deprecated.` +
`Use require('events') instead.`)
});

EventEmitter.usingDomains = false;

Expand Down

0 comments on commit 5e67eca

Please sign in to comment.