Created
July 28, 2016 15:21
-
-
Save dhenson02/0596fafc4f393bd01c1e33d09a2ca63c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var emit = commonjs.socket.emit.bind(commonjs.socket); | |
var onevent = commonjs.socket.onevent; | |
commonjs.socket.onevent = function ( packet ) { | |
var args = packet.data || []; | |
onevent.call(this, packet); // original call | |
packet.data = [ "*" ].concat(args); | |
onevent.call(this, packet); // additional call to catch-all | |
}; | |
commonjs.socket.on("*", function ( event, data ) { | |
console.log(event); | |
console.log(data); | |
}); | |
commonjs.socket.emit = function () { | |
console.log('emit', arguments); | |
return emit.apply(null, arguments) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment