Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/content/docs/concepts/architecture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ Frontend2 -> EventBus: "On('data-updated', handler)"
**Example:**
```go
// Go: Emit an event
app.EmitEvent("user-logged-in", user)
app.Event.Emit("user-logged-in", user)
```

```javascript
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/concepts/bridge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ func ProcessLargeFile(path string) error {
for scanner.Scan() {
lineNum++
// Emit progress events
app.EmitEvent("file-progress", map[string]interface{}{
app.Event.Emit("file-progress", map[string]interface{}{
"line": lineNum,
"text": scanner.Text(),
})
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/concepts/build-system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func main() {
},
})

app.NewWebviewWindow()
app.Window.New()
app.Run()
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/contributing/runtime-internals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ win := app.Window.New(&application.WebviewWindowOptions{
win.Show()
```

`NewWebviewWindow` delegates to `internal/runtime/webview_window_*.go` where
`app.Window.New()` delegates to `internal/runtime/webview_window_*.go` where
platform-specific constructors live:

```
Expand Down
12 changes: 6 additions & 6 deletions docs/src/content/docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ Use SignTool with your certificate.
Yes! Wails v3 has native multi-window support:

```go
window1 := app.NewWebviewWindow()
window2 := app.NewWebviewWindow()
window1 := app.Window.New()
window2 := app.Window.New()
```

### Does Wails support system tray?

Yes! Create system tray applications:

```go
tray := app.NewSystemTray()
tray := app.SystemTray.New()
tray.SetIcon(iconBytes)
tray.SetMenu(menu)
```
Expand All @@ -142,7 +142,7 @@ tray.SetMenu(menu)
Yes! Wails provides native dialogs:

```go
path, _ := app.OpenFileDialog().
path, _ := app.Dialog.OpenFile().
SetTitle("Select File").
PromptForSingleSelection()
```
Expand Down Expand Up @@ -194,7 +194,7 @@ wails3 generate bindings
Check if you called `Show()`:

```go
window := app.NewWebviewWindow()
window := app.Window.New()
window.Show() // Don't forget this!
```

Expand All @@ -204,7 +204,7 @@ Ensure event names match exactly:

```go
// Go
app.EmitEvent("my-event", data)
app.Event.Emit("my-event", data)

// JavaScript
OnEvent("my-event", handler) // Must match
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/features/bindings/best-practices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (s *Service) ProcessLargeFile(path string) error {
processed++

// Emit progress
s.app.EmitEvent("progress", map[string]interface{}{
s.app.Event.Emit("progress", map[string]interface{}{
"processed": processed,
"total": total,
"percent": int(float64(processed) / float64(total) * 100),
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/features/bindings/methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ const config = await GetConfig()
func ProcessLargeFile(path string) error {
// Emit progress events
for line := range lines {
app.EmitEvent("progress", line)
app.Event.Emit("progress", line)
}
return nil
}
Expand Down Expand Up @@ -530,7 +530,7 @@ func main() {
},
})

app.NewWebviewWindow()
app.Window.New()
app.Run()
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/features/bindings/models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ func main() {
},
})

app.NewWebviewWindow()
app.Window.New()
app.Run()
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/features/bindings/services.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func (o *OrderService) CreateOrder(items []Item) (*Order, error) {
}

// Emit event
o.app.EmitEvent("order-created", order)
o.app.Event.Emit("order-created", order)

return order, nil
}
Expand Down Expand Up @@ -485,7 +485,7 @@ func NewNotificationService(app *application.Application) *NotificationService {

func (n *NotificationService) Notify(message string) {
// Use application to emit events
n.app.EmitEvent("notification", message)
n.app.Event.Emit("notification", message)

// Or show system notification
n.app.ShowNotification(message)
Expand Down Expand Up @@ -780,7 +780,7 @@ func main() {
},
})

app.NewWebviewWindow()
app.Window.New()
app.Run()
}
```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/features/clipboard/basics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ await CopyToClipboard("Text to copy")
```go
func copyWithFeedback(text string) {
if app.Clipboard.SetText(text) {
app.InfoDialog().
app.Dialog.Info().
SetTitle("Copied").
SetMessage("Text copied to clipboard!").
Show()
} else {
app.ErrorDialog().
app.Dialog.Error().
SetTitle("Copy Failed").
SetMessage("Failed to copy to clipboard.").
Show()
Expand Down Expand Up @@ -296,7 +296,7 @@ func (cm *ClipboardMonitor) checkClipboard() {

if text != cm.lastText {
cm.lastText = text
cm.app.EmitEvent("clipboard-changed", text)
cm.app.Event.Emit("clipboard-changed", text)
}
}
```
Expand Down
28 changes: 14 additions & 14 deletions docs/src/content/docs/features/dialogs/custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Create **custom dialog windows** using regular Wails windows with dialog-like be

```go
// Create custom dialog window
dialog := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
dialog := app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Custom dialog",
Width: 400,
Height: 300,
Expand Down Expand Up @@ -48,7 +48,7 @@ func NewCustomdialog(app *application.Application) *Customdialog {
result: make(chan string, 1),
}

dialog.window = app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
dialog.window = app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Custom dialog",
Width: 400,
Height: 300,
Expand Down Expand Up @@ -79,7 +79,7 @@ func (d *Customdialog) Close(result string) {
```go
func ShowModaldialog(parent *application.WebviewWindow, title string) string {
// Create dialog
dialog := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
dialog := app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: title,
Width: 400,
Height: 200,
Expand Down Expand Up @@ -119,7 +119,7 @@ func NewFormdialog(app *application.Application) *Formdialog {
done: make(chan bool, 1),
}

fd.window = app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
fd.window = app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Enter Information",
Width: 500,
Height: 400,
Expand Down Expand Up @@ -156,7 +156,7 @@ func (fd *Formdialog) Cancel() {

```go
func ShowConfirmdialog(message string) bool {
dialog := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
dialog := app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Confirm",
Width: 400,
Height: 150,
Expand All @@ -172,12 +172,12 @@ func ShowConfirmdialog(message string) bool {
result := make(chan bool, 1)

// Handle responses
app.OnEvent("confirm-yes", func(e *application.CustomEvent) {
app.Event.On("confirm-yes", func(e *application.CustomEvent) {
result <- true
dialog.Close()
})

app.OnEvent("confirm-no", func(e *application.CustomEvent) {
app.Event.On("confirm-no", func(e *application.CustomEvent) {
result <- false
dialog.Close()
})
Expand Down Expand Up @@ -215,7 +215,7 @@ function confirm(result) {

```go
func ShowInputdialog(prompt string, defaultValue string) (string, bool) {
dialog := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
dialog := app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Input",
Width: 400,
Height: 150,
Expand All @@ -234,15 +234,15 @@ func ShowInputdialog(prompt string, defaultValue string) (string, bool) {
})
})

app.OnEvent("input-submit", func(e *application.CustomEvent) {
app.Event.On("input-submit", func(e *application.CustomEvent) {
result <- struct {
value string
ok bool
}{e.Data.(string), true}
dialog.Close()
})

app.OnEvent("input-cancel", func(e *application.CustomEvent) {
app.Event.On("input-cancel", func(e *application.CustomEvent) {
result <- struct {
value string
ok bool
Expand All @@ -266,7 +266,7 @@ type Progressdialog struct {
func NewProgressdialog(title string) *Progressdialog {
pd := &Progressdialog{}

pd.window = app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
pd.window = app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: title,
Width: 400,
Height: 150,
Expand Down Expand Up @@ -336,7 +336,7 @@ func NewLogindialog(app *application.Application) *Logindialog {
}, 1),
}

ld.window = app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
ld.window = app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Login",
Width: 400,
Height: 250,
Expand Down Expand Up @@ -421,7 +421,7 @@ func NewSettingsdialog(app *application.Application, current map[string]interfac
done: make(chan bool, 1),
}

sd.window = app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
sd.window = app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Settings",
Width: 600,
Height: 500,
Expand Down Expand Up @@ -470,7 +470,7 @@ func NewWizarddialog(app *application.Application) *Wizarddialog {
done: make(chan bool, 1),
}

wd.window = app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
wd.window = app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Setup Wizard",
Width: 600,
Height: 400,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/features/drag-and-drop/files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ window.OnWindowEvent(events.Common.WindowFilesDropped, func(event *application.W
details := event.Context().DropTargetDetails()

// Send to frontend
app.EmitEvent("files-dropped", map[string]any{
app.Event.Emit("files-dropped", map[string]any{
"files": files,
"target": details.ElementID,
})
Expand Down
Loading
Loading