Return SignalBinding instead of Function

瀏覽次數:19 次
跳到第一則未讀訊息

simon

未讀,
2011年4月3日 下午3:18:072011/4/3
收件者:as3-signals
I was reading this[1] and thought it would be a lot more powerful to
return the binding rather than the listener. I couldn't find the
source-code that Joa was talking about anywhere, so I spent some time
just implementing it. You can see it here[2] with the unit tests as
well and I'm wondering what peoples thoughts are?

There are two things which are causing a few niggles with me:

1. The ISignalBinding has execute0, execute1, etc and I think this
opens up the implementation a bit to much. I'm thinking about how to
avoid this without returning a binding wrapped in a class. I'm also
wanting to test the performance of execute0, execute1, etc and see if
they're needed. My initial tests show that there isn't massive
improvement for small number of arguments (4-6 arguments passed in a
signal constructor). The larger the number arguments, the more the
performance widens.
2. When removing a listener, I have to search the lists for the
binding, then I have to search the bindings again to remove it. This
is because filterNot removes the element and returns the list. Ideally
we could do these two in one run, maybe returning some type of tuple
with the removed item return as well as this list?

[1] https://github.com/robertpenner/as3-signals/issues#issue/33
[2] https://github.com/stickupkid/as3-signals
回覆所有人
回覆作者
轉寄
0 則新訊息