1 2 3 4 5 6 7 8 9 10 11 12 13
function debugEvents(obj) { var emitFunc = obj.emit; obj.emit = function() { var emitArgs = arguments; //Do something else to emitArgs here console.log("Emitting [" + JSON.stringify(arguments) + "]."); emitFunc.apply(obj, arguments); } }
You can clone a snippet to your computer for local editing. Learn more.