摘要: //使用原型实现观察者模式 function Observer() { this.fns = []; } Observer.prototype = { //订阅 subscribe: function(fn) { this.fns.push(fn); }, //退订 unsubscribe: function(fn) { this.fns = this.fns.filter... 阅读全文
posted @ 2019-05-28 23:46 SunLemon 阅读(195) 评论(0) 推荐(0) 编辑