Automatically Update WebApp Components like Plots with Genie/Stipple

Hello, I would like to know if there is a generic way of automatically update e.g. plots or other elements on the webpage created with stippleUI without explicit triggering some buttons or sliders.

I would like to run a simulation and show the results live in a WebApp.

Some hints would be great.

Hi @stakaz I just came across your question and I think it is very interesting. You have probably found a solution already, but I will post something anyway. Keep in mind that I am new to Julia and the community here, so take my advice with caution :rofl:

I have been working with Genie and Stipple recently and I think this approach will work:

  1. Use the handlers to create a reactive variable “TimerEvent” like @out TimerEvent

  2. Use a handler to monitor the timer change:

    @onchange TimerEvent, slider1, slider2, plotdata begin
    … [your code to update plots or other elements]…
    end

Just a side note… you can declare multiple onchange events if you need to respond differently to different events… for example adding a reset button (first thing I thought of):

 @onchange resetBtn begin  
      ...... [your code to reset plots or other elements].... 
  end 
  1. I think you can use the javascript setInterval() function mdn web docs - setInterval to set your desired interval. The code that you set could change the value of the reactive variable, like TimerEvent =! TimerEvent to trigger the onchange handler event.