| 1 | package main |
| 2 | |
| 3 | import "strings" |
| 4 | |
| 5 | // emitRemoteEvent bridges a kernel callback to the frontend through the async |
| 6 | // emitter so a slow webview never blocks the kernel. |
| 7 | func (a *App) emitRemoteEvent(name string, payload any) { |
| 8 | if a.remoteEventHook != nil { |
| 9 | a.remoteEventHook(name, payload) |
| 10 | } |
| 11 | if strings.HasPrefix(name, "remote-tab:") && strings.HasSuffix(name, ":state") { |
| 12 | a.emitRuntimeStateChanged() |
| 13 | } |
| 14 | ctx := a.bootContext() |
| 15 | if ctx == nil { |
| 16 | return |
| 17 | } |
| 18 | a.runtimeEvents.Emit(ctx, name, payload) |
| 19 | } |
| 20 |