listeners order fix

This commit is contained in:
Dmitri Granetchi
2014-06-02 23:48:23 +03:00
parent f79373d7e5
commit 820144ceab
+3 -4
View File
@@ -187,10 +187,9 @@ class Signal<T> {
} }
public function add(listener:T):Void { public function add(listener:T):Void {
if (listeners.indexOf(listener) == -1) { var pos = listeners.indexOf(listener);
checkLock(); if (pos == -1) checkLock(); else listeners.splice(pos, 1);
listeners.push(listener); listeners.push(listener);
}
} }
public function remove(listener:T):Void { public function remove(listener:T):Void {