diff --git a/v3/examples/wml/assets/index.html b/v3/examples/wml/assets/index.html new file mode 100644 index 00000000..26819800 --- /dev/null +++ b/v3/examples/wml/assets/index.html @@ -0,0 +1,19 @@ + + + + + Wails ML Demo + + +

Wails ML Demo

+

This application contains no Javascript!

+ + + + + + + +
Hover over me
+ + \ No newline at end of file diff --git a/v3/examples/wml/main.go b/v3/examples/wml/main.go new file mode 100644 index 00000000..a6238511 --- /dev/null +++ b/v3/examples/wml/main.go @@ -0,0 +1,50 @@ +package main + +import ( + "embed" + _ "embed" + "log" + + "github.com/wailsapp/wails/v3/pkg/application" +) + +//go:embed assets/* +var assets embed.FS + +func main() { + + app := application.New(application.Options{ + Name: "Wails ML Demo", + Description: "A demo of the Wails ML API", + Mac: application.MacOptions{ + ApplicationShouldTerminateAfterLastWindowClosed: true, + }, + }) + + app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{ + Title: "Wails ML Demo", + Width: 800, + Height: 600, + Assets: application.AssetOptions{ + FS: assets, + }, + Mac: application.MacWindow{ + Backdrop: application.MacBackdropTranslucent, + TitleBar: application.MacTitleBarHiddenInsetUnified, + InvisibleTitleBarHeight: 50, + }, + }) + + app.Events.On("button-pressed", func(_ *application.CustomEvent) { + println("Button Pressed!") + }) + app.Events.On("hover", func(_ *application.CustomEvent) { + println("Hover time!") + }) + + err := app.Run() + + if err != nil { + log.Fatal(err.Error()) + } +}