Sync/keepalive for Blink.jl/Interact.jl?

#1

I’m sure I just haven’t been good enough at reading the docs/source, but I can’t seem to find any obviously canonical way of using Blink.jl without having it quit immediately. I mean, I could use it from the REPL, but other than that? If I run a Julia program such as, say, one based on a simple Interact example, i.e.,

using Interact, Blink
ui = button()
w = Window()
body!(w, ui)

then that runs just fine, setting up the window properly … and then the program quits. If I add, say, an infinite loop or read(stdin) or something at the end, things work as they should, but surely there must be a better way of doing this? (Is there, for example, a process I could wait for, or something?) I’m assuming not everyone is using Blink from the REPL…?

I’m sorry for probably missing something obvious, here :->

#2

Maybe there is a better way, but heres your infinite loop…

while window.content.sock.state == WebSockets.ReadyState(1) 
       sleep(0.1)
end
#3

Thanks. I’d sort of hope there’d be a better way :-}

#4

Me too. I use that in a context where I have the loop running anyway from a package function in a REPL session, and just need to check the window is still there.

I haven’t actually tried to run it from a script.