#12 fix addObserver函数异常错误

This commit is contained in:
yhh
2020-07-27 17:27:32 +08:00
parent 506f8ddc0f
commit 60921f703b
6 changed files with 71 additions and 52 deletions

View File

@@ -36,7 +36,7 @@ module es {
this._messageTable.set(eventType, list);
}
if (list.contains(handler))
if (list.findIndex(funcPack => funcPack.func == handler) != -1)
console.warn("您试图添加相同的观察者两次");
list.push(new FuncPack(handler, context));
}