This PR addresses the issue by loading blink.js and webio.bundle.js whenever content is loaded using a custom URL. This was achieved by passing the URL of the websocket server to createWindow in main.js. This allowed the required JS files to be loaded whenever the Electron BrowserWindow does a navigation (i.e. when Julia calls loadurl or creates a window with :url defined).
Also, this PR fixes a warning that would fire every time the WebSocket would reconnect or whenever blink.js was reloaded. The warning was being fired from here:
// server.jl
function ws_handler(ws)
id = try parse(Int, split(ws.request.target, "/", keepempty=false)[end]) catch e @goto fail end
haskey(pool, id) || @goto fail
p = pool[id].value
active(p) && @goto fail
p.sock = ws
@async @errs get(handlers(p), "init", identity)(p)
try
put!(p.cb, true) # HERE (Warning: ErrorException("internal consistency error detected for Future"))
catch e
@warn e
end
Finally, I saw this #TODO in src/AtomShell/window.jl that might be relevant to these changes:
Is there any way I can address that #TODO in this PR?
Addresses an issue brought up here https://github.com/JuliaGizmos/Blink.jl/issues/150 and here https://github.com/JuliaGizmos/Blink.jl/issues/303. To summarize, those issues both mention that
Blink
was not defined when usingloadurl
.This PR addresses the issue by loading
blink.js
andwebio.bundle.js
whenever content is loaded using a custom URL. This was achieved by passing the URL of the websocket server tocreateWindow
in main.js. This allowed the required JS files to be loaded whenever the Electron BrowserWindow does a navigation (i.e. when Julia callsloadurl
or creates a window with :url defined).Also, this PR fixes a warning that would fire every time the
WebSocket
would reconnect or wheneverblink.js
was reloaded. The warning was being fired from here:Finally, I saw this
#TODO
insrc/AtomShell/window.jl
that might be relevant to these changes:Is there any way I can address that
#TODO
in this PR?