Forum: Rails Spinoffs (closed, excessive spam) Firing native events

952a2d4a8d447d7b0f139ad3569a223c?d=identicon&s=25 andy.kriger@gmail.com (Guest)
on 2008-07-09 14:44
(Received via mailing list)
I saw this discussion about how native events cannot be fired by
Element.fire and how that could be solved with a custom-event proxy
http://groups.google.com/group/rubyonrails-spinoff...

Can any of you more experienced Prototype/JavaScript coders give me
feedback on this solution? It adds a method to Element that lets me
register for native events and automatically create a proxy. Are there
any sideeffects I'm not aware of to doing this? (I'm an experienced
Java coder, but very new to JavaScript and the dynamic prototype-style
of coding).

Element.addMethods({
    createObserverProxy:function(ele,evt,proxy_evt,handler) {
      ele.observe(evt,function(){this.fire(proxy_evt)},false);
      if(handler instanceof Array) {
        for(var i = 0; i <handler.length; i++) {
          ele.observe(proxy_evt,handler,false);
        }
      } else {
        ele.observe(proxy_evt,handler,false);
      }
    }
  });
Ca3e484c121268e4c8302616b2395eb9?d=identicon&s=25 T.J. Crowder (Guest)
on 2008-07-09 14:44
(Received via mailing list)
Hi,

We've started transitioning to a new, better-named, hopefully-spam-
free group for Prototype and script.aculo.us:

   http://groups.google.com/group/prototype-scriptaculous/

   prototype-scriptaculous@googlegroups.com

Could you please post your question there instead?  Thanks!  People
might still answer here, but probably not for all that much longer...
--
T.J. Crowder
tj / crowder software / com

On Jul 9, 12:59 pm, "andy.kri...@gmail.com" <andy.kri...@gmail.com>
952a2d4a8d447d7b0f139ad3569a223c?d=identicon&s=25 andy.kriger@gmail.com (Guest)
on 2008-07-09 14:48
(Received via mailing list)
Done. Thank you for the heads-up.
This topic is locked and can not be replied to.