Пример #1
0
func (self *EventStream) RemoveListener(name string, m *machine.Machine) {
	key := fmt.Sprintf("%s-%s", name, m.String())
	if _, ok := self.listeners[key]; ok {
		delete(self.listeners, key)
	}
}
Пример #2
0
func (self *EventStream) AddListener(name string, m *machine.Machine, l interface{}) {
	listener := EventListener{m, l}
	key := fmt.Sprintf("%s-%s", name, m.String())
	self.listeners[key] = listener
}