What Happen? We Git Signal
The majority of commenters preferred Github to Google Code so I moved the Signals project there:
I am experimenting with mirroring back to the Google Code SVN. It's going ok so far.
Committing Early and Often
I made about 20 commits to Github this weekend. Some highlights:
- The package is now org.osflash.signals (previously com.robertpenner).
I wanted it to have more of a community feel. Thanks Aral for the namespace!
- Listener priority is now supported in ISignal.add().
- ISignal.dispatch() can now send any number of arguments to listeners.
Zero or ten, it's up to you.
- Various classes and APIs were renamed for clarity.
- More unit tests and fixes.
Since my last post about connecting EventDispatchers to Signals, I had another idea for integration:
Why not use EventDispatcher for the actual dispatching but wrap it in a Signal facade?
Presenting the NativeSignal class, which lets you have your cake and eat it too.
- Take any EventDispatcher, e.g. Sprite.
- Create a NativeSignal that targets an event of the dispatcher:
// in a subclass: click = new NativeSignal(this, 'click', MouseEvent); // or decorating an instance: click = new NativeSignal(theDispatcher, 'click', MouseEvent);
- Enjoy the Signal APIs and features.
- Dispatch from the NativeSignal or the EventDispatcher. Both use Flash's native dispatchEvent().
If you're hesitant to put your trust in new dispatching code, or you want to keep your EventDispatcher options open, this is the gateway drug for you. You don't have to give up anything. All the native functionality stays, and the ISignal interface can be piped in like frosting, wherever you like. Doesn't that sound delicious?