CJSignals project homepage
You might be able to tell from the project name that this project is inspired by Robert Penner's AS3 Signals. Yes, this is the case, indeed.
I've studied C# before, and played with Qt in the last semester. I felt the same thing Robert felt about the Event System in C# and the Signals/Slots System in Qt. It makes much more sense to extend an observer framework with composition rather than inheritance, and it makes code cleaner and more comprehensible if an object dispatches events of just one type, which is not the case for the ActionScript 3.0 native event dispatchers, for they can dispatch multiple types of events.
With CJSignals, each type of event corresponds to a
Signal object "owned", a term for composition, by the subject. For instance, you can write code like this.
The parameter types of the listener matches those specified in the signal constructor. For information on the actual usage, you may check out the tutorial wiki page.
I built CJSignals from the ground up, using my own implementation of signals to boost performance, mainly performance concerning listener priority management and listener removal. I used the fast-splicing array technique I mentioned in this post, which is also employed by Rusher for active component priority management. And the priority sorting is only executed upon signal dispatch and if necessary.
Here's a comparison chart of the performance for the native event system, CJSignals, and AS3 Signals. Although CJSignals places second or third in some tests, the actual numerical results do not pose as bottleneck. What is more important is that CJSignals has the best worst-case performance: the worst test result for CJSignals is merely 13ms, whereas that for the native event system is 681ms, and AS3 Signals 5717ms.