46

从观察者模式到手写EventEmitter源码

 5 years ago
source link: https://juejin.im/post/5b987d92e51d450e51625080
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
观察者模式 观察者模式(observer)广泛的应用于javascript语言中,浏览器事件(如鼠标单击click,键盘事件keyDown)都是该模式的例子。设计这种模式背后的主要原因是促进形成低耦合,在这种模式中不是简单的对象调用对象,而是一个对象“订阅”另

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK