Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 447 Bytes

README.md

File metadata and controls

25 lines (19 loc) · 447 Bytes

What

a simple event bus in golang

Use

	bus := NewBus()
	sub := NewSub()

	bus.Subscribe("topic1", sub)

	go func() {
		msg := sub.Out().(int)
		if msg != 7 {
			t.Fatalf("got wrong number:%d", msg)
		}
	}()
	bus.Publish("topic1", 7)
	// or use PubFunc to publish to a certain topic
	pubFunc := bus.PubFunc("topic1")
	pubFunc(7)

For more details,see testfile