Skip to content

Instantly share code, notes, and snippets.

@rich97
Created August 2, 2011 13:09
Show Gist options
  • Save rich97/1120138 to your computer and use it in GitHub Desktop.
Save rich97/1120138 to your computer and use it in GitHub Desktop.
// I don't like this:
/*
socket.on('answer', function(answer, fn) {
socket.get('game', function(ge, g) {
socket.get('score', function(se, score) {
*/
// this is much nicer, I could even make a function to keep it DRY
var test;
socket.get('socket_var', function(err, socket_variable) {
test = socket_variable;
});
console.log(test);
// Hi! I'm a socket variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment