No, prototype's methods for working with events' cache are completely
private.
I really doubt you can access them, but extending Event.observe seems
like a perfect solution.

Something like this should work, though I haven't tested thoroughly:

Element.addMethods({
  observe: Element.Methods.observe.wrap(
    function(proceed, element, eventName, handler) {
      element = $(element);
      Event._cache = Event._cache || { };
      Event._cache[eventName] = Event._cache[eventName] || [];
      Event._cache[eventName].push(handler);
      return proceed(element, eventName, handler);
  })
})

element.observe('click', function(){ alert('foo') });
element.observe('click', function(){ alert('bar') });

Event._cache.click; // [function(), function()] <== these are your
handlers for 'click' event

Event._cache.click[0](); // alerts 'foo' <== this is your first
handler
Event._cache.click[1](); // alerts 'bar' <== this is a second one
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to