Skip to content

Instantly share code, notes, and snippets.

@pantlesswonder
Created November 11, 2012 02:38
Show Gist options
  • Save pantlesswonder/4053451 to your computer and use it in GitHub Desktop.
Save pantlesswonder/4053451 to your computer and use it in GitHub Desktop.
socket.io code
//code
c.prototype.emit = function(a) {
var b = Array.prototype.slice.call(arguments, 1), c = b[b.length - 1], d = {type: "event",name: a};
return "function" == typeof c && (d.id = ++this.ackPackets, d.ack = "data", this.acks[d.id] = c, b = b.slice(0, b.length - 1)), d.args = b, this.packet(d)
}
//approximate state on the return line
a: "chat"
arguments: Arguments[2]
0: "chat"
1: "test"
callee: function (a){var b=Array.prototype.slice.call(arguments,1),c=b[b.length-1],d={type:"event",name:a};return"function"==typeof c&&(d.id=++this.ackPackets,d.ack="data",this.acks[d.id]=c,b=b.slice(0,b.length-1)),d.args=b,this.packet(d)}
length: 2
b: Array[1]
0: "test"
length: 1
__proto__: Array[0]
c: "test"
d: Object
name: "chat"
type: "event"
__proto__: Object
this: c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment