2020年5月20日
摘要: // 被观察者 class Subject{ // 定义一个对象 constructor(){ // 构造器 可以实例一个对象 this.subs = [] // 存储观察者 } addsub(sub){ // 添加观察者 this.subs.push(sub) } notify(food){ // 阅读全文
posted @ 2020-05-20 20:00 carry,carry 阅读(138) 评论(0) 推荐(1) 编辑