Observer-观察者模式¶
备注
is a publish/subscribe pattern, which allows a number of observer objects to see an event. Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
有各种不同的叫法:
Subject-Observer
Publisher-Subscriber(一对多关系,可同步也可异步)
Producer-Consumer(多对多关系,一般是异步)
EventEmitter-EventListener
Dispatcher-Listener
参考¶
The Observer Pattern In Go: https://levelup.gitconnected.com/the-observer-design-pattern-in-go-d564048fe9f6