Add browser inbox receiver

This commit is contained in:
2026-06-27 18:39:01 +08:00
parent fb68c54409
commit a2791c494f
14 changed files with 734 additions and 32 deletions
+7
View File
@@ -35,6 +35,13 @@ func (b *Bus) Subscribe(event string, handler Handler) {
b.handlers[event] = append(b.handlers[event], handler)
}
// HasSubscribers reports whether an event has at least one registered handler.
func (b *Bus) HasSubscribers(event string) bool {
b.mu.RLock()
defer b.mu.RUnlock()
return len(b.handlers[event]) > 0
}
// Unsubscribe removes all handlers for a plugin (matched by prefix or exact).
// For now, a simple version: clear all handlers for a given event name.
func (b *Bus) Unsubscribe(event string) {