From 2ee45e061ee457c8c0da7bacd76a03b160520126 Mon Sep 17 00:00:00 2001 From: nuanbing <1498262377@qq.com> Date: Tue, 28 Feb 2017 15:57:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E6=AC=A1=E7=9B=91=E5=90=AC=20?= =?UTF-8?q?=E7=A7=BB=E9=99=A4observer=E5=8C=B9=E9=85=8D=20=E4=BB=85?= =?UTF-8?q?=E4=BF=9D=E7=95=99name=E5=8C=BA=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WxNotificationCenter/WxNotificationCenter.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/WxNotificationCenter/WxNotificationCenter.js b/WxNotificationCenter/WxNotificationCenter.js index b06e781..4b61c9a 100644 --- a/WxNotificationCenter/WxNotificationCenter.js +++ b/WxNotificationCenter/WxNotificationCenter.js @@ -46,19 +46,18 @@ function addNotification(name, selector, observer) { * name: 注册名,一般let在公共类中 * selector: 对应的通知方法,接受到通知后进行的动作 * observer: 注册对象,指Page对象 + * 备注: 不同监听使用不同的name */ function addOnceNotification(name, selector, observer) { if (__notices.length > 0) { for (var i = 0; i < __notices.length; i++) { var notice = __notices[i]; if (notice.name === name) { - if (notice.observer === observer) { - return; - } + return; } } - this.addNotification(name, selector, observer) } + this.addNotification(name, selector, observer) } function addNotices(newNotice) {