Signals and Slots is submitted!
Your script is now in the approval queue. After a quick review we will notify you of the script's status by email. If everything's alright, we'll publish your work to the site and rss feed. Otherwise, we'll send you the email explaining what seems questionable. In that case, reply to the email whenever we should review the script again.
Also, don't hesitate to discuss things if you feel that our reasons are unfair. We are real folk, and we don't like bureaucracy. : )
Thank you for your contribution!
1
Signals and slots allows you to register a function to be called whenever another function is called. It goes beyond DOM event listeners and allows you to turn any function into an event. The function you are listening for is called the 'signal' and any functions whho are listeners are called 'slots'. So when the signal function is applied, all the slot functions are also applied, typically with the same arguments as the signal function.
The main benefit of doing things this way is that it becomes an anonymous transport mechanism that allows you to pass information between objects without the objects having to know about each other. A lot of Prototype objects take functions as arguments for callback purposes. Signals and slots negates the need for callbacks. I demonstrated this in the entry Signals and Slots is King. And it potentially makes for cleaner simpler code.
- Website:
-
Signals and Slots
- Author:
-
Andrew Tetlaw
- Size:
- 4 KB
- Last modified:
- 09/26/2007
- License:
-
n/a
- Tags:
- event
- Rating:
-
4
(4/5 from 3 votes)
- Your rating:
-
0
Not yet rated
- Please sign in or register to rate this script
- You can't rate your own script.