摘要:
//手写eventhub(发布订阅) // 核心思路:1.使用一个对象作为缓存 // 2.on负责把方法发布到缓存的eventName数组中 // 3.emit负责遍历eventName中的方法数组 // 4.off负责清除缓存中的方法 class EventHub { cache={} on(ev 阅读全文
posted @ 2021-03-09 10:21 米粒3 阅读(102) 评论(0) 推荐(0)
|
摘要:
//手写eventhub(发布订阅) // 核心思路:1.使用一个对象作为缓存 // 2.on负责把方法发布到缓存的eventName数组中 // 3.emit负责遍历eventName中的方法数组 // 4.off负责清除缓存中的方法 class EventHub { cache={} on(ev 阅读全文
posted @ 2021-03-09 10:21 米粒3 阅读(102) 评论(0) 推荐(0) |
||