From 820144ceab169d03101b5a6d6cde8c0484502151 Mon Sep 17 00:00:00 2001 From: Dmitri Granetchi Date: Mon, 2 Jun 2014 23:48:23 +0300 Subject: [PATCH] listeners order fix --- src/bindx/BindSignal.hx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/bindx/BindSignal.hx b/src/bindx/BindSignal.hx index 30349cb..3b343e5 100644 --- a/src/bindx/BindSignal.hx +++ b/src/bindx/BindSignal.hx @@ -187,10 +187,9 @@ class Signal { } public function add(listener:T):Void { - if (listeners.indexOf(listener) == -1) { - checkLock(); - listeners.push(listener); - } + var pos = listeners.indexOf(listener); + if (pos == -1) checkLock(); else listeners.splice(pos, 1); + listeners.push(listener); } public function remove(listener:T):Void {