energy/README.md

79 lines
3.3 KiB
Markdown
Raw Normal View History

2022-12-03 15:05:07 +08:00
# Energy is Go's framework for building desktop applications based on CEF
2022-12-03 15:19:38 +08:00
[中文 ](README.zh_CN.md) |
2022-12-03 15:05:07 +08:00
English
2022-10-04 16:21:00 +08:00
2022-10-06 16:39:52 +08:00
---
2022-12-03 15:05:07 +08:00
### [Introduction](https://energy.yanghy.cn/#/course/6342d92c401bfe4d0cdf6065/6350f94ca749ba0318943f25)
> [Energy](https://github.com/energye/energy) Is a framework for building desktop applications using JavaScript,HTML, and CSS based on [Golcl](https://github.com/energye/golcl) and [CEF4Delphi](https://github.com/salvadordf/CEF4Delphi) Pure Go language development framework, embedded [Chromium CEF](https://bitbucket.org/chromiumembedded/cef) binary
2022-10-06 16:39:52 +08:00
>
2022-12-03 15:05:07 +08:00
> Allows you to use [Web]() front-end technology to build cross-platform applications on Windows, Linux, and MacOS
2022-10-06 16:39:52 +08:00
>
2022-12-03 15:05:07 +08:00
>> You can use the [Energy](https://github.com/energye/energy) and [Golcl](https://github.com/energye/golcl) to build compact system UI cross-platform application separately
2022-10-06 16:39:52 +08:00
>
2022-12-03 15:05:07 +08:00
> Supports Windows_32, 64 bits, Linux_x86_64 bits, MacOS_x86_64 bits
>
> In Go and Web technologies, based on IPC communication, you can easily interact data, function calls, and event calls between Go and Web without the need for a Web Service interface, just as easily as calling functions in the language itself
2022-11-04 14:59:01 +08:00
>
2022-12-03 15:05:07 +08:00
> In Go, you can also define JS variables, which can be used by Web end JS to realize Go variable or structure object data synchronization
2022-11-04 14:59:01 +08:00
>
2022-12-03 15:05:07 +08:00
> Call JS function and JS event listener in Go to realize functional interaction between GO and JS
2022-11-04 14:59:01 +08:00
>
2022-12-03 15:05:07 +08:00
> Call Go function in JS, listen to events of Go, and realize functional interaction between JS and GO
2022-10-04 16:21:00 +08:00
2022-12-03 15:05:07 +08:00
### [![windows 32 bits](https://img.shields.io/badge/Downloads-green)](https://energy.yanghy.cn/#/course/6342d92c401bfe4d0cdf6065/6364c5c2a749ba01d04ff485)
2022-10-06 16:39:52 +08:00
2022-12-03 15:05:07 +08:00
#### [Installation Environment](https://energy.yanghy.cn/#/course/6342d92c401bfe4d0cdf6065/63511b14a749ba0318943f3a)
> Install it automatically using the energy command line tool
2022-11-28 22:44:13 +08:00
>
> 1. go get github.com/energye/energy
>
> 2. cd energy/cmd/energy
>
> 3. go install
>
> 4. energy install .
2022-10-18 15:15:29 +08:00
2022-12-03 15:05:07 +08:00
### [Getting started guide](https://energy.yanghy.cn)
* [tutorial](https://energy.yanghy.cn/#/course/6342d92c401bfe4d0cdf6065/6350f94ca749ba0318943f25)
* [sample](https://energy.yanghy.cn/#/example/6342d986401bfe4d0cdf6067/634d3bd5a749ba0318943eb6)
* [document](https://energy.yanghy.cn/#/document/6342d9a4401bfe4d0cdf6069/0)
2022-10-06 16:39:52 +08:00
2022-12-03 15:05:07 +08:00
### Quick start
#### Basic needs
2022-10-06 16:39:52 +08:00
> golang >= 1.9.2
>
2022-12-03 15:05:07 +08:00
> 1. Use the energy command line tool to automatically install environment dependencies
2022-11-20 17:38:29 +08:00
>
2022-12-03 15:05:07 +08:00
> 2. Configure the ENERGY_HOME environment variable, ENERGY_HOME= framework root
2022-10-06 16:39:52 +08:00
>
2022-12-03 15:05:07 +08:00
> Example/simple example
2022-10-06 16:39:52 +08:00
>
2022-11-20 17:38:29 +08:00
> go mod tidy
2022-10-06 16:39:52 +08:00
>
2022-12-03 15:05:07 +08:00
> IDE run simple
2022-10-06 16:39:52 +08:00
>
2022-12-03 15:05:07 +08:00
> Currently, the command line tools do not support packaged applications, Windows you can use (MSI or Inno Setup) and other green packaging tools, Deb installation package in Linux, MacOS generates. App packages by default or custom. App packages
2022-10-06 16:39:52 +08:00
2022-12-03 15:05:07 +08:00
##### example/simple code
2022-10-06 16:39:52 +08:00
```go
package main
import (
"github.com/energye/energy/cef"
)
func main() {
2022-12-03 15:05:07 +08:00
//Global initialization, which every application must call
2022-11-20 12:31:41 +08:00
cef.GlobalCEFInit(nil, nil)
2022-12-03 15:05:07 +08:00
//Creating an Application
2022-11-20 12:31:41 +08:00
cefApp := cef.NewApplication(nil)
2022-12-03 15:05:07 +08:00
//Specify a URL address, or a local html file directory
cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn"
2022-12-03 15:05:07 +08:00
//Running the Application
2022-10-06 16:39:52 +08:00
cef.Run(cefApp)
}
2022-12-03 15:05:07 +08:00
2022-10-06 16:39:52 +08:00
```
2022-10-18 17:21:02 +08:00
2022-10-18 18:16:16 +08:00
----
2022-12-03 15:05:07 +08:00
### [License GPL 3.0](https://opensource.org/licenses/GPL-3.0)