MCPcopy Create free account
hub / github.com/DNAProject/DNA / Notify

Method Notify

events/event.go:73–87  ·  view source on GitHub ↗

Notify subscribers that Subscribe specified event

(eventtype EventType, value interface{})

Source from the content-addressed store, hash-verified

71
72//Notify subscribers that Subscribe specified event
73func (e *Event) Notify(eventtype EventType, value interface{}) (err error) {
74 e.m.RLock()
75 defer e.m.RUnlock()
76
77 subs, ok := e.subscribers[eventtype]
78 if !ok {
79 err = errors.New("No event type.")
80 return
81 }
82
83 for _, event := range subs {
84 go e.NotifySubscriber(event, value)
85 }
86 return
87}
88
89func (e *Event) NotifySubscriber(eventfunc EventFunc, value interface{}) {
90 if eventfunc == nil {

Callers 4

NotifyAllMethod · 0.95
TestNewEventFunction · 0.95
startSigSvrFunction · 0.80
waitToExitFunction · 0.80

Calls 1

NotifySubscriberMethod · 0.95

Tested by 1

TestNewEventFunction · 0.76