sender callback 등록 함수 추가
This commit is contained in:
@ -97,7 +97,23 @@ type Sender struct {
|
|||||||
Region string
|
Region string
|
||||||
Accid primitive.ObjectID
|
Accid primitive.ObjectID
|
||||||
Alias string
|
Alias string
|
||||||
DisconnectedCallbacks map[string]func()
|
disconnectedCallbacks map[string]func()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Sender) RegistDisconnectedCallback(name string, f func()) (old func()) {
|
||||||
|
if s.disconnectedCallbacks == nil {
|
||||||
|
s.disconnectedCallbacks = make(map[string]func())
|
||||||
|
}
|
||||||
|
|
||||||
|
old = s.disconnectedCallbacks[name]
|
||||||
|
s.disconnectedCallbacks[name] = f
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Sender) PopDisconnectedCallback(name string) func() {
|
||||||
|
old := s.disconnectedCallbacks[name]
|
||||||
|
delete(s.disconnectedCallbacks, name)
|
||||||
|
return old
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventReceiver interface {
|
type EventReceiver interface {
|
||||||
|
|||||||
Reference in New Issue
Block a user