From 64fc756fb1fc40858e75f62bd00b92a88bb88608 Mon Sep 17 00:00:00 2001 From: mildmojo Date: Fri, 6 Oct 2017 21:41:10 -0400 Subject: [PATCH] Fixes dat.gui listener state display. Was holding on to a reference to the original listener after switching between WebSocket and HTTP listeners. So it would show the status for WebSocket listener, but never update for the HTTP listener. --- public/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 661ec2f..567db18 100644 --- a/public/index.html +++ b/public/index.html @@ -27,7 +27,7 @@ // Set up dat.gui for switching connection types and params at runtime. var gui = new dat.GUI(); gui.add(guiController, 'mode').listen(); - gui.add(guiController.listener, 'state').listen(); + gui.add(guiController, 'state').listen(); gui.add(guiController, 'stopAll'); gui.add(guiController, 'startWebSocket'); gui.add(guiController, 'startHTTPPolling'); @@ -38,6 +38,7 @@ var guiController = { mode: 'WebSocket Events', listener: null, + get state() { return this.listener.state; }, startWebSocket: function() { if (this.listener) this.listener.stop(); this.mode = 'WebSocket Events';