diff --git a/dispatcher.go b/bus.go similarity index 80% rename from dispatcher.go rename to bus.go index 3d01f94..a7c0806 100644 --- a/dispatcher.go +++ b/bus.go @@ -1,14 +1,14 @@ package events -type Dispatcher struct { +type Bus struct { topics map[string]*topic } -func New() *Dispatcher { - return &Dispatcher{topics: make(map[string]*topic)} +func New() *Bus { + return &Bus{topics: make(map[string]*topic)} } -func (d *Dispatcher) On(event string, receiver interface{}) error { +func (d *Bus) On(event string, receiver interface{}) error { // TODO: make thread safe t, hasTopic := d.topics[event] if !hasTopic { @@ -25,7 +25,7 @@ func (d *Dispatcher) On(event string, receiver interface{}) error { return nil } -func (d *Dispatcher) Fire(event string, args ...interface{}) { +func (d *Bus) Fire(event string, args ...interface{}) { // TODO: make thead safe topic, hasTopic := d.topics[event] if !hasTopic { diff --git a/dispatcher_test.go b/bus_test.go similarity index 100% rename from dispatcher_test.go rename to bus_test.go