22
33![ Logo] ( https://raw.githubusercontent.com/webui-dev/webui-logo/main/webui_go.png )
44
5- # Go-WebUI
5+ # Go-WebUI v2.5.0
66
77#### [ Features] ( #features ) · [ Installation] ( #installation ) · [ Usage] ( #usage ) · [ Documentation] ( #documentation ) · [ WebUI] ( https://github.com/webui-dev/webui )
88
2626## Features
2727
2828- Parent library written in pure C
29- - Fully Independent ( _ No need for any third-party runtimes _ )
30- - Lightweight ~ 200 Kb & Small memory footprint
31- - Fast binary communication protocol between WebUI and the browser ( _ Instead of JSON _ )
29+ - Portable ( * Needs only a web browser or a WebView at runtime * )
30+ - Lightweight ( * Few Kb library * ) & Small memory footprint
31+ - Fast binary communication protocol
3232- Multi-platform & Multi-Browser
3333- Using private profile for safety
34+ - Cross-platform WebView
3435
3536## Installation
3637
3940
4041- ### As Go module
4142
42- The easiest way to setup go-webui as a Go module is to use the ` setup.sh ` script.
43+ The easiest way to setup go-webui as a Go module is to use the ` setup.sh ` or ` setup.bat ` script.
4344
4445 It will run ` go get ` to retrieve the go-webui module and bootstrap the version of the WebUI C library that it is using.
4546
46- - Release version
47+ - Windows
4748
4849 ``` sh
49- # Available soon.
50- # sh -c "$(curl -fsSL https://raw.githubusercontent.com/webui-dev/go-webui/v2.5.1-beta-1.0/setup.sh)"
50+ sh -c " $( curl -fsSL https://raw.githubusercontent.com/webui-dev/go-webui/main/setup.bat) "
5151 ```
5252
53- - Development version
53+ - Linux / macOS
5454
5555 ``` sh
5656 sh -c " $( curl -fsSL https://raw.githubusercontent.com/webui-dev/go-webui/main/setup.sh) "
8181 ` replace ` the path accordingly in the ` g.mod ` file.
8282
8383 ```
84- require github.com/webui-dev/go-webui/v2 v2.4.3
84+ require github.com/webui-dev/go-webui/v2 v2.5.0
8585
86- replace github.com/webui-dev/go-webui/v2 v2.4.3 => ./modules/go-webui
86+ replace github.com/webui-dev/go-webui/v2 v2.5.0 => ./modules/go-webui
8787 ```
8888
8989- ### As git clone - for development and contribution purposes
105105<html >
106106 <head >
107107 <script src =" webui.js" ></script >
108- <style >
109- body {
110- background : linear-gradient (to left , #36265a , #654da9 );
111- color : AliceBlue ;
112- font : 16px sans-serif ;
113- text-align : center ;
114- margin-top : 30px ;
115- }
116- </style >
117108 </head >
118109 <body >
119- <h1 >Welcome to WebUI!</h1 >
120- <input type =" text" id =" name" value =" Neo" />
121- <button onclick =" handleGoResponse();" >Call Go</button >
122- <br />
123- <samp id =" greeting" ></samp >
110+ <button onclick =" test();" >Test Go-WebUI</button >
124111 <script >
125- async function handleGoResponse () {
126- const inputName = document .getElementById (' name' );
112+ async function test () {
127113 // Call a Go function.
128- const result = await webui . greet ( inputName . value );
129- document . getElementById ( ' greeting ' ). innerHTML = result;
114+ const result = await myGoFunction ( ' Hello From JavaScript ' );
115+ alert (result); // "Hello From Go"
130116 }
131117 </script >
132118 </body >
@@ -143,18 +129,20 @@ import (
143129 ui " github.com/webui-dev/go-webui/v2"
144130)
145131
146- func greet (e ui .Event ) string {
132+ func myGoFunction (e ui .Event ) string {
133+ // Get first argument
147134 name , _ := ui.GetArg [string ](e)
148- fmt.Printf (" %s has reached the backend!\n " , name)
149- jsResp := fmt.Sprintf (" Hello %s 🐇" , name)
150- return jsResp
135+ fmt.Printf (" JavaScript sent: %s \n " , name) // Hello From JavaScript
136+ // Return a response to JavaScript
137+ response := fmt.Sprintf (" Hello From Go" )
138+ return response
151139}
152140
153141func main () {
154142 // Create a window.
155143 w := ui.NewWindow ()
156144 // Bind a Go function.
157- ui.Bind (w, " greet " , greet )
145+ ui.Bind (w, " myGoFunction " , myGoFunction )
158146 // Show frontend.
159147 w.Show (" index.html" )
160148 // Wait until all windows get closed.
@@ -224,16 +212,27 @@ Think of WebUI like a WebView controller, but instead of embedding the WebView c
224212
225213## Wrappers
226214
227- | Language | Status | Link |
228- | ----------------------- | -------------- | --------------------------------------------------------- |
229- | Go | ✔️ | [ Go-WebUI] ( https://github.com/webui-dev/go-webui ) |
230- | Nim | ✔️ | [ Nim-WebUI] ( https://github.com/webui-dev/nim-webui ) |
231- | Pascal | ✔️ | [ Pascal-WebUI] ( https://github.com/webui-dev/pascal-webui ) |
232- | Python | ✔️ | [ Python-WebUI] ( https://github.com/webui-dev/python-webui ) |
233- | Rust | _ not complete_ | [ Rust-WebUI] ( https://github.com/webui-dev/rust-webui ) |
234- | TypeScript / JavaScript | ✔️ | [ Deno-WebUI] ( https://github.com/webui-dev/deno-webui ) |
235- | V | ✔️ | [ V-WebUI] ( https://github.com/webui-dev/v-webui ) |
236- | Zig | _ not complete_ | [ Zig-WebUI] ( https://github.com/webui-dev/zig-webui ) |
215+ | Language | v2.4.0 API | v2.5.0 API | Link |
216+ | --------------- | --- | -------------- | --------------------------------------------------------- |
217+ | Python | ✔️ | _ not complete_ | [ Python-WebUI] ( https://github.com/webui-dev/python-webui ) |
218+ | Go | ✔️ | _ not complete_ | [ Go-WebUI] ( https://github.com/webui-dev/go-webui ) |
219+ | Zig | ✔️ | _ not complete_ | [ Zig-WebUI] ( https://github.com/webui-dev/zig-webui ) |
220+ | Nim | ✔️ | _ not complete_ | [ Nim-WebUI] ( https://github.com/webui-dev/nim-webui ) |
221+ | V | ✔️ | _ not complete_ | [ V-WebUI] ( https://github.com/webui-dev/v-webui ) |
222+ | Rust | _ not complete_ | _ not complete_ | [ Rust-WebUI] ( https://github.com/webui-dev/rust-webui ) |
223+ | TS / JS (Deno) | ✔️ | _ not complete_ | [ Deno-WebUI] ( https://github.com/webui-dev/deno-webui ) |
224+ | TS / JS (Bun) | _ not complete_ | _ not complete_ | [ Bun-WebUI] ( https://github.com/webui-dev/bun-webui ) |
225+ | Swift | _ not complete_ | _ not complete_ | [ Swift-WebUI] ( https://github.com/webui-dev/swift-webui ) |
226+ | Odin | _ not complete_ | _ not complete_ | [ Odin-WebUI] ( https://github.com/webui-dev/odin-webui ) |
227+ | Pascal | _ not complete_ | _ not complete_ | [ Pascal-WebUI] ( https://github.com/webui-dev/pascal-webui ) |
228+ | Purebasic | _ not complete_ | _ not complete_ | [ Purebasic-WebUI] ( https://github.com/webui-dev/purebasic-webui ) |
229+ | - | | |
230+ | Common Lisp | _ not complete_ | _ not complete_ | [ cl-webui] ( https://github.com/garlic0x1/cl-webui ) |
231+ | Delphi | _ not complete_ | _ not complete_ | [ WebUI4Delphi] ( https://github.com/salvadordf/WebUI4Delphi ) |
232+ | C# | _ not complete_ | _ not complete_ | [ WebUI4CSharp] ( https://github.com/salvadordf/WebUI4CSharp ) |
233+ | WebUI.NET | _ not complete_ | _ not complete_ | [ WebUI.NET] ( https://github.com/Juff-Ma/WebUI.NET ) |
234+ | QuickJS | _ not complete_ | _ not complete_ | [ QuickUI] ( https://github.com/xland/QuickUI ) |
235+ | PHP | _ not complete_ | _ not complete_ | [ PHPWebUiComposer] ( https://github.com/KingBes/php-webui-composer ) |
237236
238237## Supported Web Browsers
239238
@@ -250,6 +249,14 @@ Think of WebUI like a WebView controller, but instead of embedding the WebView c
250249| Apple Safari | _ not available_ | _ coming soon_ | _ not available_ |
251250| Opera | _ coming soon_ | _ coming soon_ | _ coming soon_ |
252251
252+ ## Supported WebView
253+
254+ | WebView | Status |
255+ | --------------- | --------------- |
256+ | Windows WebView2 | ✔️ |
257+ | Linux GTK WebView | ✔️ |
258+ | macOS WKWebView | ✔️ |
259+
253260### License
254261
255262> Licensed under the MIT License.
0 commit comments