Completes full Wails v3 Manager API coverage through the IPC bus. Service maintains in-memory registry, delegates to Platform for native context menu operations, broadcasts ActionItemClicked on menu item clicks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 lines
531 B
Go
16 lines
531 B
Go
// pkg/contextmenu/register.go
|
|
package contextmenu
|
|
|
|
import "forge.lthn.ai/core/go/pkg/core"
|
|
|
|
// Register creates a factory closure that captures the Platform adapter.
|
|
// The returned function has the signature WithService requires: func(*Core) (any, error).
|
|
func Register(p Platform) func(*core.Core) (any, error) {
|
|
return func(c *core.Core) (any, error) {
|
|
return &Service{
|
|
ServiceRuntime: core.NewServiceRuntime[Options](c, Options{}),
|
|
platform: p,
|
|
menus: make(map[string]ContextMenuDef),
|
|
}, nil
|
|
}
|
|
}
|