.
This commit is contained in:
parent
aa2f7c2003
commit
f958610bbf
|
@ -5,6 +5,13 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
type Observer interface {
|
||||
Add(id string, ch chan interface{}) error
|
||||
Remove(id string, rch chan interface{}) error
|
||||
Notify(id string, arg interface{}) error
|
||||
}
|
||||
|
||||
|
||||
type observer struct {
|
||||
mtx sync.Mutex
|
||||
events map[string][]chan interface{}
|
||||
|
@ -80,6 +87,10 @@ func init() {
|
|||
|
||||
// interface
|
||||
|
||||
func GetInstance() Observer {
|
||||
return _observer
|
||||
}
|
||||
|
||||
func Add(id string, ch chan interface{}) error {
|
||||
return _observer.Add(id, ch)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user