在 Go + HTML5 中构建跨平台的现代桌面应用程序
罗卡 □ 特性
此外,设计上的局限性:
如果您想要对浏览器窗口拥有更多的控制 - 考虑使用 [webview] (https://github.com/zserge/webview) 库中类似API,所以 移徙将是平稳的。
□ 实例
(原始内容存档于2019-09-29) (英语). ```go ui, _ := lorca.New("", "", 480, 320) defer ui.Close()
// Bind Go function to be available in JS. Go function may be long-running and // blocking - in JS it's represented with a Promise. ui.Bind("add", func(a, b int) int { return a + b })
// Call JS function from Go. Functions may be asynchronous, i.e. return promises
n := ui.Eval(Math.random()).Float()
fmt.Println(n)
// Call JS that calls Go and so on and so on...
m := ui.Eval(add(2, 3)).Int()
fmt.Println(m)
// Wait for the browser window to be closed <-ui.Done()
<p对齐="中心"++/p>
另外,关于捆绑功能和包装二进制的更详细情况,请参见[例 (例).
□ 哈罗世界
下面是执行“你好世界”例子的步骤。
ZZ1ZZ
# 如何运作 #
在头罩下,Lorca使用[Chrome DevTools议定书](https://chromedevtools.github.io/devtools-protocol/)作为Chrome实例上的仪器。 首先洛卡试图找到你似乎不再起作用了
lorca.New 由于 lorca.readUntilMatch 返回 EOF
在 Mac 上打开应用程序时打开一个空窗口
已停止的项目
使用最新的 Chrome 版本运行
绑定错误
如何调用 Vue 函数?
如何在一个窗口中显示所有选项卡?
如何将 Go 代码添加到 Lorca 中,以自动下载 Chromium 并在 Chromium 上加载 URL
使 HTML 表单数据触发另一个函数