防止删除一个空的函数发生未定义报错
This commit is contained in:
@@ -34,7 +34,8 @@ class Emitter<T> {
|
||||
public removeObserver(eventType: T, handler: Function){
|
||||
let messageData = this._messageTable.get(eventType);
|
||||
let index = messageData.findIndex(data => data.func == handler);
|
||||
messageData.removeAt(index);
|
||||
if (index != -1)
|
||||
messageData.removeAt(index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user