Stubs (15 files, 479 exports): - All managers: Dialog, Event, Browser, Clipboard, ContextMenu, Environment, Screen, KeyBinding - Window interface (~50 methods), BrowserWindow, platform options (iOS/Android) - MenuItem (42 roles), WebviewWindowOptions (full platform types) - Wails v3 submodule pinned at alpha 74 New events package (17th package): - Custom event system bridged to Core IPC - TaskEmit, TaskOn, TaskOff, QueryListeners, ActionEventFired Feature expansions: - Window: zoom, content (SetURL/SetHTML/ExecJS), bounds, print, flash - Screen: QueryCurrent, ScreenPlacement, Rect geometry - Dialog: typed tasks, file options, Info/Question/Warning/Error - Keybinding: TaskProcess, ErrorNotRegistered - Notification: RevokePermission, RegisterCategory, action broadcasts - Dock: SetProgressBar, Bounce/StopBounce - Environment: HasFocusFollowsMouse - ContextMenu: QueryGetAll, TaskUpdate, TaskDestroy Display bridge: 5 new event types wired to WebSocket MCP: 4 event tools (emit, on, off, list) 17 packages build and test clean (1 flaky test ordering issue in window). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
26 lines
894 B
Go
26 lines
894 B
Go
// pkg/events/platform.go
|
|
package events
|
|
|
|
// Platform abstracts the custom event backend (Wails v3 EventManager).
|
|
// Emit fires an event by name with optional data arguments.
|
|
// On registers a persistent listener; returns a cancel function.
|
|
// Off removes all listeners for the named event.
|
|
// OnMultiple registers a listener that auto-deregisters after counter firings.
|
|
// Reset removes all custom event listeners.
|
|
//
|
|
// cancel := platform.On("build:done", func(e *CustomEvent) { ... })
|
|
// defer cancel()
|
|
// platform.Emit("build:done", result)
|
|
type Platform interface {
|
|
Emit(name string, data ...any) bool
|
|
On(name string, callback func(event *CustomEvent)) func()
|
|
Off(name string)
|
|
OnMultiple(name string, callback func(event *CustomEvent), counter int)
|
|
Reset()
|
|
}
|
|
|
|
// CustomEvent is the event object delivered to On/OnMultiple listeners.
|
|
type CustomEvent struct {
|
|
Name string
|
|
Data any
|
|
}
|