From: Darren Date: Sun, 1 Sep 2013 13:09:34 +0000 (+0100) Subject: Don't clobber over the event emitters _callbacks X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f621d0ff7973ecb6cfc339a86519119b4bbc28ab;p=KiwiIRC.git Don't clobber over the event emitters _callbacks --- diff --git a/client/assets/libs/engine.io.tools.js b/client/assets/libs/engine.io.tools.js index 9852e8a..8e7c264 100644 --- a/client/assets/libs/engine.io.tools.js +++ b/client/assets/libs/engine.io.tools.js @@ -111,7 +111,7 @@ var EngineioTools = { var self = this; this._next_id = 0; - this._callbacks = {}; + this._rpc_callbacks = {}; this._socket = eio_socket; this._mixinEmitter(); @@ -203,7 +203,7 @@ var EngineioTools = { packet.id = this._next_id; this._next_id++; - this._callbacks[packet.id] = callback; + this._rpc_callbacks[packet.id] = callback; } this.send(packet); @@ -236,12 +236,12 @@ var EngineioTools = { if (this._isResponse(packet)) { // If we have no callback waiting for this response, don't do anything - if (typeof this._callbacks[packet.id] !== 'function') + if (typeof this._rpc_callbacks[packet.id] !== 'function') return; // Call and delete this callback once finished with it - this._callbacks[packet.id].apply(this, packet.response); - delete this._callbacks[packet.id]; + this._rpc_callbacks[packet.id].apply(this, packet.response); + delete this._rpc_callbacks[packet.id]; } else if (this._isCall(packet)) { // Calls with an ID may be responded to diff --git a/server/websocketrpc.js b/server/websocketrpc.js index 01c3ef9..9743018 100644 --- a/server/websocketrpc.js +++ b/server/websocketrpc.js @@ -8,7 +8,7 @@ function WebsocketRpc(eio_socket) { var self = this; this._next_id = 0; - this._callbacks = {}; + this._rpc_callbacks = {}; this._socket = eio_socket; this._mixinEmitter(); @@ -100,7 +100,7 @@ WebsocketRpc.prototype.call = function(method) { packet.id = this._next_id; this._next_id++; - this._callbacks[packet.id] = callback; + this._rpc_callbacks[packet.id] = callback; } this.send(packet); @@ -133,12 +133,12 @@ WebsocketRpc.prototype._onMessage = function(message_raw) { if (this._isResponse(packet)) { // If we have no callback waiting for this response, don't do anything - if (typeof this._callbacks[packet.id] !== 'function') + if (typeof this._rpc_callbacks[packet.id] !== 'function') return; // Call and delete this callback once finished with it - this._callbacks[packet.id].apply(this, packet.response); - delete this._callbacks[packet.id]; + this._rpc_callbacks[packet.id].apply(this, packet.response); + delete this._rpc_callbacks[packet.id]; } else if (this._isCall(packet)) { // Calls with an ID may be responded to