Micheal/Don,
If you want to use an Object method as an Element event observer you
can.
element.observe(''click'', function(){ MyObject.method(); });
If you want to use Classes and have them fire events you can use this
extension.
http://github.com/kangax/protolicious/tree/master/class.observable.js
//Class
var Person = Class.create(Class.Observable, {....});
//Custom Object
MyObj = {};
Object.extend(MyObj, Class.Observable);
Or if you want all Classes created to have the ability to fire and
observe methods you can do something like: http://pastie.caboo.se/191329
On a technical note, I think Juriy''s code needs to have the
":" colon
added automatically to the eventName so when passed to the dummy
element they will be handled as custom events (see my pastie as a
reference).
I believe something like this hasn’t been added to the core because
the core team may view it as something that could easily be created
via an extension. I could be wrong. (Juriy’s solution is by far the
most elegant approach I have seen).
MooTool offers a similar extension for their framework via their
download page.
MooTools is a modular framework so there are many extensions and
additions available on their download page (written by the MooTools
core devs). Prototype is not modular and users have to go to third
party sites like http://scripteka.com/ to get extensions created by
developers in the community.
- JDD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---