From 25751bedfe7b227dd3690a1e4bdee14fc9a2d517 Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Tue, 2 Feb 2016 19:57:21 -0600 Subject: [PATCH] node: deprecate process.EventEmitter The comment stating it was deprecated was added in 2011 via 4ef8f06fe62edb74fded0e817266cb6398e69f36. It is time to actually deprecate it. PR-URL: https://github.com/nodejs/node/pull/5049 Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Roman Reiss --- src/node.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index 1f29386a87714f..2856943e4a9e78 100644 --- a/src/node.js +++ b/src/node.js @@ -20,7 +20,17 @@ }); EventEmitter.call(process); - process.EventEmitter = EventEmitter; // process.EventEmitter is deprecated + let eeWarned = false; + Object.defineProperty(process, 'EventEmitter', { + get() { + const internalUtil = NativeModule.require('internal/util'); + eeWarned = internalUtil.printDeprecationMessage( + `process.EventEmitter is deprecated. Use require('events') instead.`, + eeWarned + ); + return EventEmitter; + } + }); startup.setupProcessObject();