Chinese | English


github
release
license
repo

go-version

Project Description

energy is a framework developed by Go based on CEF (Chromium Embedded Framework), embedded with CEF binary

Use Go and web-side technologies ( HTML + CSS + JavaScript ) to build cross-platform desktop applications that support Windows, Linux, and MacOS

Need to know the front-end technology stack and a little understanding of Go language

characteristic

  • The development environment is simple and the compilation speed is fast. Only the Go development environment and the CEF binary framework that Energy depends on are required.
  • Cross-platform: a set of code can be packaged into Windows, domestic UOS, Deepin, Kylin, MacOS, Linux
  • language responsibility
  • Go: Go is responsible for window creation, CEF configuration and function implementation, various UI component creation, system low-level calls, and functions that JS cannot handle, such as: file streaming, security encryption, high-performance processing, etc., and can be used as a pure back-end development
  • Web: HTML + CSS + JavaScript is responsible for the functions of the client interface, making any interface you want, which can be used as a pure front-end development
  • Front-end technology: Support mainstream front-end frameworks such as: Vue, React, Angular, or pure HTML+CSS, etc.
  • Event-driven: high-performance event-driven, based on IPC communication, it is very convenient to realize function calling and data interaction between Go and Web

Event-driven Go and Web interaction

  • Based on IPC communication between Go and Web technology, you can interact data and event triggers between Go and Web, and you don’t need to use the http interface, just as simple as calling the function of the language itself
  • Define JS binding type variables in Go, provide them to JS on the web side, and realize data synchronization of Go variables or structural objects
  • Listen to events in JS and trigger JS events in Go to achieve Go calling JS functions and data transfer
  • Listen to events in Go and trigger Go events in JS to achieve JS calling Go functions and data transfer

Built-in dependencies & integrations

development environment

basic needs

  • golang >= 1.18
  • energy development environment

Use the energy command-line tool to automatically install the development environment

Get the energy project, or directly use the precompiled command line tool to download the address

  1. go get github.com/energye/energy

Enter the energy command line directory 2. cd energy/cmd/energy

Install command line tools 3. go install

Execute the installation command 4. energy install .

Getting Started Guide – Portal

quick start

Use the energy command line tool to automatically install environment dependencies energy install .

Take the example/simple example as an example

Update the latest release version dependencies

  1. go mod tidy

Run simple in the IDE or go run simple.go

example/simple example code

package main

import (
	"github.com/energye/energy/cef"
)

func main() {
	//全局初始化 每个应用都必须调用的
	cef.GlobalInit(nil, nil)
	//创建应用
	cefApp := cef.NewApplication(nil)
	//指定一个URL地址,或本地html文件目录
	cef.BrowserWindow.Config.Url = "https://energy.yanghy.cn"
	//运行应用
	cef.Run(cefApp)
}

Project Packaging Reference

  1. Compile: Go program compilationgo build xxx.go If you use built-in resources (HTML, CSS, JavaScript, Image, etc.), the resources will be compiled into the executable file
  2. Copy: Copy the execution file to the CEF directory of the ENERGY environment
  3. Packaging: Use the tool to make an installation package to make it into an installation package, and refer to the creation of installation packages for each system platform
  4. Finally: The compiled program or installation package and the CEF directory no longer need to configure the environment, and can be run directly in the CEF root directory

Go compile command

  1. Compress and hide cmd window go build -ldflags "-H windowsgui -s -w"Note: Windows needs to hide the CMD window
  2. It will compress and not hide the cmd window go build -ldflags "-s -w"
  3. Do not compress or hide the cmd window go build

System Support

Windows
Mac OS X
Linux


QQ exchange group

QQGroup


project screenshot

Windows-10

Windows-7 32 & 64


Linux – Domestic Deepin


Linux – Domestic Kylin ARM


Linux-Ubuntu


Mac OS X


open source agreement

license

#Energy #develop #crossplatform #desktop #applications #Windows #MacOSX #Linux #framework #developed #based #CEF #Chromium #Embedded #Framework #embedded #CEF #binary

Leave a Comment

Your email address will not be published. Required fields are marked *