Skip to content

Commit

Permalink
App method to create panel exposed to every OS
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpare committed Sep 20, 2024
1 parent 7797e2e commit 76558b9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 18 additions & 0 deletions v3/pkg/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,24 @@ func (a *App) NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *W
return newWindow
}

func (a *App) NewWebviewPanelWithOptions(panelOptions WebviewPanelOptions) *WebviewPanel {
newPanel := NewPanel(panelOptions)
id := newPanel.ID()

a.windowsLock.Lock()
a.windows[id] = newPanel
a.windowsLock.Unlock()

// Call hooks
for _, hook := range a.windowCreatedCallbacks {
hook(newPanel)
}

a.runOrDeferToAppRun(newPanel)

return newPanel
}

func (a *App) NewSystemTray() *SystemTray {
id := a.getSystemTrayID()
newSystemTray := newSystemTray(id)
Expand Down
18 changes: 0 additions & 18 deletions v3/pkg/application/application_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,21 +363,3 @@ func (a *App) platformEnvironment() map[string]any {
func fatalHandler(errFunc func(error)) {
return
}

func (a *App) NewWebviewPanelWithOptions(panelOptions WebviewPanelOptions) *WebviewPanel {
newPanel := NewPanel(panelOptions)
id := newPanel.ID()

a.windowsLock.Lock()
a.windows[id] = newPanel
a.windowsLock.Unlock()

// Call hooks
for _, hook := range a.windowCreatedCallbacks {
hook(newPanel)
}

a.runOrDeferToAppRun(newPanel)

return newPanel
}

0 comments on commit 76558b9

Please sign in to comment.