Skip to content

Instantly share code, notes, and snippets.

@evanlucas
Created December 19, 2017 19:41
Show Gist options
  • Save evanlucas/6767876c52aa5bd3a072f931566c7876 to your computer and use it in GitHub Desktop.
Save evanlucas/6767876c52aa5bd3a072f931566c7876 to your computer and use it in GitHub Desktop.
Show every event that is emitted
'use strict'
const EE = require('events')
const emit = EE.prototype.emit
EE.prototype.emit = function(name, ...args) {
if (this.constructor) {
console.log('EMIT', this.constructor.name, name)
} else {
console.log('EMIT', '<unknown>', name)
}
return emit.call(this, name, ...args)
}
@evanlucas
Copy link
Author

Instead of using node index.js, now, run with node -r ./ee-debug.js index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment