Hi, there, I'm a novice to Julia as well as HTML. I'd like to use Blink.jl and a .html file to build a desktop app.
The issue is that in the documentation, they design the GUI with body!() and that's too simple for a GUI. I've create a HTML file but always have difficult to connect it with Julia.
I've tried "load!, loadhtml, importhtml! , loadurl, load file " with my .html file. But no one works. Some of them just loading forever and some of them can load the html file and show the GUI, but using @js can't pass the value from julia to the frontend.
It's weird that this package have hundreds of stars but with a simple documentation and none of demo or examples. I tried to switch my Julia version from 1.6.0 , 1.6.7 to 1.8.0. they never worked.
Could someone give me a simple showcase that load a html file with functional connection between julia and html?
Here is my code,
julia file
using Blink
# @js console.log("hello, web-scale world!!!!")
w = Window(async=false) # Open a new window
# content!(w, "body", html)
# body!(w, "Hello World", async=false) # Set the body content
handle(w, "press") do args
@show args
println(args)
end
opentools(w)
@js w x = 5
# load!(w, "./index.html")
# loadurl(w, "C:/Users/yli/Desktop/my-electron-app/index.html")
importhtml!(w, "C:/Users/yli/Desktop/my-electron-app/index.html")
html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button onclick="blinkMessage">test</button>
<script>
function blinkMessage() {
console.log("button tiggered")
Blink.msg("press", "Hello from JS");
}
</script>
<p>hi??</p>
</body>
</html>
and this is the error cased by these code
ERROR: Javascript error unknown: blank
Stacktrace:
[1] js(o::Page, js::WebIO.JSString; callback::Bool)
@ Blink ~\.julia\packages\Blink\mwJC9\src\rpc\rpc.jl:53
[2] js(win::Window, s::WebIO.JSString; callback::Bool)
@ Blink.AtomShell ~\.julia\packages\Blink\mwJC9\src\AtomShell\window.jl:257
[3] js(o::Window, j::Expr; callback::Bool)
@ Blink ~\.julia\packages\Blink\mwJC9\src\rpc\rpc.jl:61
[4] js
@ ~\.julia\packages\Blink\mwJC9\src\rpc\rpc.jl:61 [inlined]
[5] importhtml!(w::Window, url::String; async::Bool)
@ Blink ~\.julia\packages\Blink\mwJC9\src\content\api.jl:40
[6] importhtml!(w::Window, url::String)
@ Blink ~\.julia\packages\Blink\mwJC9\src\content\api.jl:32
[7] top-level scope
@ ~\Desktop\my-electron-app\juliabackend.jl:25
Hi, there, I'm a novice to Julia as well as HTML. I'd like to use Blink.jl and a .html file to build a desktop app.
The issue is that in the documentation, they design the GUI with body!() and that's too simple for a GUI. I've create a HTML file but always have difficult to connect it with Julia.
I've tried "load!, loadhtml, importhtml! , loadurl, load file " with my .html file. But no one works. Some of them just loading forever and some of them can load the html file and show the GUI, but using @js can't pass the value from julia to the frontend.
It's weird that this package have hundreds of stars but with a simple documentation and none of demo or examples. I tried to switch my Julia version from 1.6.0 , 1.6.7 to 1.8.0. they never worked.
Could someone give me a simple showcase that load a html file with functional connection between julia and html?
Here is my code,
julia file
html file
and this is the error cased by these code