From ca683d7cb996e3f4fcef819c2e31c6ab5d6cac7f Mon Sep 17 00:00:00 2001 From: Alec Winograd Date: Wed, 10 Dec 2014 14:36:00 -0800 Subject: [PATCH] Delete events from queue rather than set to null --- .../javascripts/websocket_rails/websocket_rails.js.coffee | 2 +- src/websocket_rails/websocket_rails.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/websocket_rails/websocket_rails.js.coffee b/app/assets/javascripts/websocket_rails/websocket_rails.js.coffee index 5c1d542..c87a5f8 100644 --- a/app/assets/javascripts/websocket_rails/websocket_rails.js.coffee +++ b/app/assets/javascripts/websocket_rails/websocket_rails.js.coffee @@ -68,7 +68,7 @@ class @WebSocketRails event = new WebSocketRails.Event(data) if event.is_result() @queue[event.id]?.run_callbacks(event.success, event.data) - @queue[event.id] = null + delete @queue[event.id] else if event.is_channel() @dispatch_channel event else diff --git a/src/websocket_rails/websocket_rails.js b/src/websocket_rails/websocket_rails.js index b7e8227..d12897b 100644 --- a/src/websocket_rails/websocket_rails.js +++ b/src/websocket_rails/websocket_rails.js @@ -1,4 +1,4 @@ - +// Generated by CoffeeScript 1.6.3 /* WebsocketRails JavaScript Client @@ -19,7 +19,8 @@ Listening for new events from the server Stop listening for new events from the server dispatcher.unbind('event') - */ +*/ + (function() { var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; @@ -88,7 +89,7 @@ Stop listening for new events from the server if ((_ref = this.queue[event.id]) != null) { _ref.run_callbacks(event.success, event.data); } - this.queue[event.id] = null; + delete this.queue[event.id]; } else if (event.is_channel()) { this.dispatch_channel(event); } else {