From 3de53341614f5ec7b9a4f2c0483b2dab46d2d888 Mon Sep 17 00:00:00 2001
From: lancebeet <jw@31-208-45-132.cust.bredband2.com>
Date: Sun, 4 Mar 2018 11:59:06 +0100
Subject: [PATCH] fixes for webio update

---
 src/gui.jl | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/gui.jl b/src/gui.jl
index 684256c..846a22f 100644
--- a/src/gui.jl
+++ b/src/gui.jl
@@ -2,7 +2,8 @@ export Widget_Container, GUI, set!, add!, animate
 
 mutable struct Widget_Container
     #Widgets with symbols
-    widgets::Array{WebIO.Node{WebIO.DOM},1}
+    #widgets::Array{WebIO.Node{WebIO.DOM},1}
+    widgets
     vals::Dict
 end
 
@@ -44,6 +45,13 @@ function GUI()
     GUI(10)
 end
 
+function (gui::GUI)()
+    # This ensures that observables don't time out, removing this will 
+    # break everything and it will be impossible to track down.
+    watched = Node(:div, style=Dict(:display=>"none"), gui.widgets.widgets...)
+    Node(:div, gui.dom, watched)
+end
+
 function set!(gui::GUI, widgets::Widget_Container)
     gui.widgets = widgets
     gui.values = [obs(widget).val for widget in gui.widgets.widgets]
@@ -149,7 +157,8 @@ function update(gui::GUI, s::Symbol, watchsymbol=:0)
     # if the value of the widget associated with watchsymbol has changed
     w = gui.widgets[s]
     if watchsymbol==:0||has_changed(gui, watchsymbol)
-        obs(w).listeners[2](obs(w)[])
+        #obs(w).listeners[2](obs(w)[])
+        obs(w)[] = obs(w)[]
     end
 end
 function update(gui::GUI, a::Array, watchsymbol=:0)
-- 
GitLab