MCPcopy
hub / github.com/tmrts/go-patterns / Observer

Interface Observer

behavioral/observer/main.go:20–24  ·  view source on GitHub ↗

Observer defines a standard interface for instances that wish to list for the occurrence of a specific event.

Source from the content-addressed store, hash-verified

18 // Observer defines a standard interface for instances that wish to list for
19 // the occurrence of a specific event.
20 Observer interface {
21 // OnNotify allows an event to be "published" to interface implementations.
22 // In the "real world", error handling would likely be implemented.
23 OnNotify(Event)
24 }
25
26 // Notifier is the instance being observed. Publisher is perhaps another decent
27 // name, but naming things is hard.

Callers 1

NotifyMethod · 0.65

Implementers 1

eventObserverbehavioral/observer/main.go

Calls

no outgoing calls

Tested by

no test coverage detected