package evio import ( "context" "sync/atomic" ) var defaultEvio atomic.Pointer[simple] func init() { evio := New(NewMatcher).(*simple) defaultEvio.Store(evio) } func Default() Evio { return defaultEvio.Load() } func Call(topic string, data any) { Default().Call(topic, data) } func Publish(topic string, data any) error { return Default().Publish(topic, data) } func Subscribe(topic string, handler Handler, opts ...SubscribeOption) (func() bool, error) { return Default().Subscribe(topic, handler, opts...) } func Listen(topic string) (stop func(), data <-chan any, err error) { return Default().Listen(topic) } func Start(ctx context.Context) error { select { case <-ctx.Done(): return ctx.Err() default: return Default().Start() } } func Stop() error { return Default().Stop() }