From 2e5d87edb01efa19c935787f78c6a5ea2e55849b Mon Sep 17 00:00:00 2001 From: Seasonley <578709897@qq.com> Date: Sat, 17 Nov 2018 21:31:39 +0800 Subject: [PATCH] passed --- Observable.js | 22 ++++++++++++++-------- PubSub.js | 28 +++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Observable.js b/Observable.js index 03545cd..639eb0c 100644 --- a/Observable.js +++ b/Observable.js @@ -7,31 +7,37 @@ class ObserverList { constructor() { - this.observerList = []; + this.observerList = [] } add(observer) { - // todo add observer to list + return this.observerList.push(observer) } remove(observer) { - // todo remove observer from list + for(var i=0,len=this.count();i