Implements pkg/keybinding with three-layer pattern: IPC Bus -> Service -> Platform. Service maintains in-memory registry, ErrAlreadyRegistered on duplicates. QueryList reads from service registry, not platform.GetAll(). ActionTriggered broadcast on shortcut trigger via platform callback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 lines
526 B
Go
16 lines
526 B
Go
// pkg/keybinding/register.go
|
|
package keybinding
|
|
|
|
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,
|
|
bindings: make(map[string]BindingInfo),
|
|
}, nil
|
|
}
|
|
}
|