You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
382 B
18 lines
382 B
1 year ago
|
package bus
|
||
|
|
||
|
import "context"
|
||
|
|
||
|
var DefaultEmitter = New()
|
||
|
|
||
|
func Emit(ctx context.Context, topic string, data any) {
|
||
|
DefaultEmitter.Emit(ctx, topic, data)
|
||
|
}
|
||
|
|
||
|
func Listen(topic string, listener Listener, options ...ListenOption) {
|
||
|
DefaultEmitter.Listen(topic, listener, options...)
|
||
|
}
|
||
|
|
||
|
func Cancel(topic string, listeners ...Listener) {
|
||
|
DefaultEmitter.Cancel(topic, listeners...)
|
||
|
}
|