Skip to main content
 首页 » 编程设计

design-patterns之是否存在处理回调机制的设计模式

2024年11月01日35JustinYoung

是否存在处理回调机制的设计模式?

请您参考如下方法:

那就是Observer Pattern-来自维基百科

The observer pattern (a subset of the asynchronous publish/subscribe pattern) is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. It is mainly used to implement distributed event handling systems.