{"id":13393129,"url":"https://github.com/zserge/lorca","last_synced_at":"2025-04-25T14:43:59.478Z","repository":{"id":37731682,"uuid":"156127781","full_name":"zserge/lorca","owner":"zserge","description":"Build cross-platform modern desktop apps in Go + HTML5","archived":false,"fork":false,"pushed_at":"2024-08-19T06:48:40.000Z","size":544,"stargazers_count":8110,"open_issues_count":76,"forks_count":544,"subscribers_count":150,"default_branch":"master","last_synced_at":"2025-04-24T04:16:58.833Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zserge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-04T21:40:19.000Z","updated_at":"2025-04-21T17:05:37.000Z","dependencies_parsed_at":"2024-06-18T11:08:53.762Z","dependency_job_id":"bcf3fe11-986d-4faf-85ff-21eb879d0be2","html_url":"https://github.com/zserge/lorca","commit_stats":{"total_commits":98,"total_committers":26,"mean_commits":3.769230769230769,"dds":0.6020408163265306,"last_synced_commit":"a990beb2828ffa625b74500b4ae43b90fdf8b2e1"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zserge%2Florca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zserge%2Florca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zserge%2Florca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zserge%2Florca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zserge","download_url":"https://codeload.github.com/zserge/lorca/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250560057,"owners_count":21450173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T17:00:43.800Z","updated_at":"2025-04-24T04:17:04.011Z","avatar_url":"https://github.com/zserge.png","language":"Go","readme":"# Lorca\n\n[![Build Status](https://img.shields.io/github/workflow/status/zserge/lorca/CI%20Pipeline)](https://github.com/zserge/lorca)\n[![GoDoc](https://godoc.org/github.com/zserge/lorca?status.svg)](https://godoc.org/github.com/zserge/lorca)\n[![Go Report Card](https://goreportcard.com/badge/github.com/zserge/lorca)](https://goreportcard.com/report/github.com/zserge/lorca)\n\n\u003cdiv\u003e\n\u003cimg align=\"left\" src=\"https://raw.githubusercontent.com/zserge/lorca/master/lorca.png\" alt=\"Lorca\" width=\"128px\" height=\"128px\" /\u003e\n\u003cbr/\u003e\n\u003cp\u003e\n\tA very small library to build modern HTML5 desktop apps in Go. It uses Chrome\n\tbrowser as a UI layer. Unlike Electron it doesn't bundle Chrome into the app\n\tpackage, but rather reuses the one that is already installed. Lorca\n\testablishes a connection to the browser window and allows calling Go code\n\tfrom the UI and manipulating UI from Go in a seamless manner.\n\u003c/p\u003e\n\u003cbr/\u003e\n\u003c/div\u003e\n\n\n## Features\n\n* Pure Go library (no cgo) with a very simple API\n* Small application size (normally 5-10MB)\n* Best of both worlds - the whole power of HTML/CSS to make your UI look\n\tgood, combined with Go performance and ease of development\n* Expose Go functions/methods and call them from JavaScript\n* Call arbitrary JavaScript code from Go\n* Asynchronous flow between UI and main app in both languages (async/await and Goroutines)\n* Supports loading web UI from the local web server or via data URL\n* Supports testing your app with the UI in the headless mode\n* Supports multiple app windows\n* Supports packaging and branding (e.g. custom app icons). Packaging for all\n\tthree OS can be done on a single machine using GOOS and GOARCH variables.\n\nAlso, limitations by design:\n\n* Requires Chrome/Chromium \u003e= 70 to be installed.\n* No control over the Chrome window yet (e.g. you can't remove border, make it\n\ttransparent, control position or size).\n* No window menu (tray menus and native OS dialogs are still possible via\n\t3rd-party libraries)\n\nIf you want to have more control of the browser window - consider using\n[webview](https://github.com/zserge/webview) library with a similar API, so\nmigration would be smooth.\n\n## Example\n\n```go\nui, _ := lorca.New(\"\", \"\", 480, 320)\ndefer ui.Close()\n\n// Bind Go function to be available in JS. Go function may be long-running and\n// blocking - in JS it's represented with a Promise.\nui.Bind(\"add\", func(a, b int) int { return a + b })\n\n// Call JS function from Go. Functions may be asynchronous, i.e. return promises\nn := ui.Eval(`Math.random()`).Float()\nfmt.Println(n)\n\n// Call JS that calls Go and so on and so on...\nm := ui.Eval(`add(2, 3)`).Int()\nfmt.Println(m)\n\n// Wait for the browser window to be closed\n\u003c-ui.Done()\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"examples/counter/counter.gif\" /\u003e\u003c/p\u003e\n\nAlso, see [examples](examples) for more details about binding functions and packaging binaries.\n\n## Hello World\n\nHere are the steps to run the hello world example.\n\n```\ncd examples/counter\ngo get\ngo run ./\n```\n\n## How it works\n\nUnder the hood Lorca uses [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) to instrument on a Chrome instance. First Lorca tries to locate your installed Chrome, starts a remote debugging instance binding to an ephemeral port and reads from `stderr` for the actual WebSocket endpoint. Then Lorca opens a new client connection to the WebSocket server, and instruments Chrome by sending JSON messages of Chrome DevTools Protocol methods via WebSocket. JavaScript functions are evaluated in Chrome, while Go functions actually run in Go runtime and returned values are sent to Chrome.\n\n## What's in a name?\n\n\u003e There is kind of a legend, that before his execution Garcia Lorca have seen a\n\u003e sunrise over the heads of the soldiers and he said \"And yet, the sun rises...\".\n\u003e Probably it was the beginning of a poem. (J. Brodsky)\n\nLorca is an anagram of [Carlo](https://github.com/GoogleChromeLabs/carlo/), a\nproject with a similar goal for Node.js.\n\n## License\n\nCode is distributed under MIT license, feel free to use it in your proprietary\nprojects as well.\n\n","funding_links":[],"categories":["Go","Misc","Uncategorized","开源类库","👓 Alternatives to the [Electron.js](https://electronjs.org) ⚛","Open source library","others"],"sub_categories":["Uncategorized","桌面开发","Go","Desktop Development"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzserge%2Florca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzserge%2Florca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzserge%2Florca/lists"}