Hi there, I was reading some great news about prototype: it .observe and .stop features ease the life for event handling for all major browsers. For a feature I would like to have (beside the standard #onClick, #onMouseOver, etc) I need to be able to trigger custom events but I was unable to figure out if javascript objects can trigger generic events (also with custom arguments). I think this is a very powerful feature that can be implemented in Prototype somehow but I wonder if js already provides one in the existent mechanism. Anybody knows or has a reference? thank you, Sebastian --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Me again, just to illustrate.. one should be able to do something like this: anObservedExtendedDOMElement.trigger(''customEventName'', arg1, .... , argN) each time that the event occurs in your system. When an extended element triggers an event the (previously registered) listeners should receive the arguments and a function call. They should have hooked it with something like this: anObserverExtendedDOMElement.observe(anObservedElement, ''aCustomEventName'', aCustomAction) To give us (developers) an experience of completeness using events, aCustomAction should be able to receive the triggered arg1... argN of the observed element Pros: it''ll allow that several interactive predefined cases to be solved in the client side, so instantaneous responses, so better experience of the use of the applications. cheers, Sebastian PD1: it seems that all we need is to implement the #trigger function in the extended element. What else we need? PD2: if this is browser dependent, we can make our own event manager only to manage the custom listening of custom events, and (another gain) give to it an homogeneous interface, so developers can use standard or custom events without noticing diference On 19 jun, 10:04, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote:> Hi there, > > I was reading some great news about prototype: it .observe and .stop > features ease the life for event handling for all major browsers. > > For a feature I would like to have (beside the standard #onClick, > #onMouseOver, etc) I need to be able to trigger custom events but I > was unable to figure out if javascript objects can trigger generic > events (also with custom arguments). > > I think this is a very powerful feature that can be implemented in > Prototype somehow but I wonder if js already provides one in the > existent mechanism. Anybody knows or has a reference? > > thank you, > > Sebastian--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Is this what you''re talking about? http://www.someelement.com/2007/03/eventpublisher-custom-events-la-pubsub.html Maybe that will help. On 6/19/07, Sebastian Sastre <ssastre-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote:> > > Me again, > > just to illustrate.. one should be able to do something like this: > > anObservedExtendedDOMElement.trigger(''customEventName'', arg1, .... , > argN) > > each time that the event occurs in your system. > > When an extended element triggers an event the (previously > registered) listeners should receive the arguments and a function > call. They should have hooked it with something like this: > > anObserverExtendedDOMElement.observe(anObservedElement, > ''aCustomEventName'', aCustomAction) > > To give us (developers) an experience of completeness using events, > aCustomAction should be able to receive the triggered arg1... argN of > the observed element > > Pros: it''ll allow that several interactive predefined cases to be > solved in the client side, so instantaneous responses, so better > experience of the use of the applications. > > cheers, > > Sebastian > PD1: it seems that all we need is to implement the #trigger function > in the extended element. What else we need? > PD2: if this is browser dependent, we can make our own event manager > only to manage the custom listening of custom events, and (another > gain) give to it an homogeneous interface, so developers can use > standard or custom events without noticing diference > > > On 19 jun, 10:04, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > Hi there, > > > > I was reading some great news about prototype: it .observe and .stop > > features ease the life for event handling for all major browsers. > > > > For a feature I would like to have (beside the standard #onClick, > > #onMouseOver, etc) I need to be able to trigger custom events but I > > was unable to figure out if javascript objects can trigger generic > > events (also with custom arguments). > > > > I think this is a very powerful feature that can be implemented in > > Prototype somehow but I wonder if js already provides one in the > > existent mechanism. Anybody knows or has a reference? > > > > thank you, > > > > Sebastian > > > > >-- Ryan Gahl Manager, Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com -- Architect WebWidgetry.com / MashupStudio.com Future Home of the World''s First Complete Web Platform -- Inquire: 1-262-951-6727 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Ryan! my answer will be yes to the intention in going that path :) I''m happy to see that there is people that are trying this! Just a comment about what I saw that your EventPublisher: it stores the hooks of custom events globally and it is who fires the event which, thinking deep, it makes no sense unless the event is *really* happening to it. What I propose is something anything but new: it should be individual creature'' s events based in observation and occurrence. This is: arbitrary observers that can hook arbitrary events (species of events and quantities of events) that could happen to arbitrary instances that triggers arbitrary actions with arbitrary arguments. That should be a complete event solution. Given that requeriment, we have the additional option to add all this features with the same semantic that ''standard'' events have. This is, the new .trigger() (or .triggerEvent or whatever appropiate, less creative, unambiguous and unconfusive name people like to use for it) and the well known .observe(). This is desirable to simplify the developer''s access to that functionality and increase generally the Prototype''s power. cheers, Sebastian PD: another detail would be that Event shouldn''t do the observation, observers should do it. So instead of doing Event.observe we should be doing this.observe(), where this is an extended DOM element, so we should be, that way, giving the option of being observer to any element. That way any element can say "hey.. I will be interested on doingSomeStuff when something happens to him" simple, natural, beauty and powerful On 19 jun, 11:12, "Ryan Gahl" <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is this what you''re talking about? > > http://www.someelement.com/2007/03/eventpublisher-custom-events-la-pu... > > Maybe that will help. > > On 6/19/07, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > > > > > > Me again, > > > just to illustrate.. one should be able to do something like this: > > > anObservedExtendedDOMElement.trigger(''customEventName'', arg1, .... , > > argN) > > > each time that the event occurs in your system. > > > When an extended element triggers an event the (previously > > registered) listeners should receive the arguments and a function > > call. They should have hooked it with something like this: > > > anObserverExtendedDOMElement.observe(anObservedElement, > > ''aCustomEventName'', aCustomAction) > > > To give us (developers) an experience of completeness using events, > > aCustomAction should be able to receive the triggered arg1... argN of > > the observed element > > > Pros: it''ll allow that several interactive predefined cases to be > > solved in the client side, so instantaneous responses, so better > > experience of the use of the applications. > > > cheers, > > > Sebastian > > PD1: it seems that all we need is to implement the #trigger function > > in the extended element. What else we need? > > PD2: if this is browser dependent, we can make our own event manager > > only to manage the custom listening of custom events, and (another > > gain) give to it an homogeneous interface, so developers can use > > standard or custom events without noticing diference > > > On 19 jun, 10:04, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > > Hi there, > > > > I was reading some great news about prototype: it .observe and .stop > > > features ease the life for event handling for all major browsers. > > > > For a feature I would like to have (beside the standard #onClick, > > > #onMouseOver, etc) I need to be able to trigger custom events but I > > > was unable to figure out if javascript objects can trigger generic > > > events (also with custom arguments). > > > > I think this is a very powerful feature that can be implemented in > > > Prototype somehow but I wonder if js already provides one in the > > > existent mechanism. Anybody knows or has a reference? > > > > thank you, > > > > Sebastian > > -- > Ryan Gahl > Manager, Senior Software Engineer > Nth Penguin, LLChttp://www.nthpenguin.com > -- > Architect > WebWidgetry.com / MashupStudio.com > Future Home of the World''s First Complete Web Platform > -- > Inquire: 1-262-951-6727 > Blog:http://www.someElement.com--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The EventPublisher class can act as a global event dispatcher, yes... but there is also an example in that blog post on how to inherit from it to fire events local to a specific object instance. On 6/19/07, Sebastian Sastre <ssastre-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote:> > > Hi Ryan! > > my answer will be yes to the intention in going that path :) I''m > happy to see that there is people that are trying this! > > Just a comment about what I saw that your EventPublisher: it stores > the hooks of custom events globally and it is who fires the event > which, thinking deep, it makes no sense unless the event is *really* > happening to it. > > What I propose is something anything but new: it should be > individual creature'' s events based in observation and occurrence. > This is: arbitrary observers that can hook arbitrary events (species > of events and quantities of events) that could happen to arbitrary > instances that triggers arbitrary actions with arbitrary arguments. > That should be a complete event solution. > > Given that requeriment, we have the additional option to add all > this features with the same semantic that ''standard'' events have. This > is, the new .trigger() (or .triggerEvent or whatever appropiate, less > creative, unambiguous and unconfusive name people like to use for it) > and the well known .observe(). This is desirable to simplify the > developer''s access to that functionality and increase generally the > Prototype''s power. > > cheers, > > Sebastian > PD: another detail would be that Event shouldn''t do the observation, > observers should do it. So instead of doing Event.observe we should be > doing this.observe(), where this is an extended DOM element, so we > should be, that way, giving the option of being observer to any > element. That way any element can say "hey.. I will be interested on > doingSomeStuff when something happens to him" simple, natural, beauty > and powerful > > > > On 19 jun, 11:12, "Ryan Gahl" <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Is this what you''re talking about? > > > > http://www.someelement.com/2007/03/eventpublisher-custom-events-la-pu... > > > > Maybe that will help. > > > > On 6/19/07, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > > > > > > > > > > > > Me again, > > > > > just to illustrate.. one should be able to do something like this: > > > > > anObservedExtendedDOMElement.trigger(''customEventName'', arg1, .... , > > > argN) > > > > > each time that the event occurs in your system. > > > > > When an extended element triggers an event the (previously > > > registered) listeners should receive the arguments and a function > > > call. They should have hooked it with something like this: > > > > > anObserverExtendedDOMElement.observe(anObservedElement, > > > ''aCustomEventName'', aCustomAction) > > > > > To give us (developers) an experience of completeness using events, > > > aCustomAction should be able to receive the triggered arg1... argN of > > > the observed element > > > > > Pros: it''ll allow that several interactive predefined cases to be > > > solved in the client side, so instantaneous responses, so better > > > experience of the use of the applications. > > > > > cheers, > > > > > Sebastian > > > PD1: it seems that all we need is to implement the #trigger function > > > in the extended element. What else we need? > > > PD2: if this is browser dependent, we can make our own event manager > > > only to manage the custom listening of custom events, and (another > > > gain) give to it an homogeneous interface, so developers can use > > > standard or custom events without noticing diference > > > > > On 19 jun, 10:04, Sebastian Sastre <ssas...-luH6fFXSdSWH0oMTQjrRWA@public.gmane.org> wrote: > > > > Hi there, > > > > > > I was reading some great news about prototype: it .observe and > .stop > > > > features ease the life for event handling for all major browsers. > > > > > > For a feature I would like to have (beside the standard #onClick, > > > > #onMouseOver, etc) I need to be able to trigger custom events but I > > > > was unable to figure out if javascript objects can trigger generic > > > > events (also with custom arguments). > > > > > > I think this is a very powerful feature that can be implemented in > > > > Prototype somehow but I wonder if js already provides one in the > > > > existent mechanism. Anybody knows or has a reference? > > > > > > thank you, > > > > > > Sebastian > > > > -- > > Ryan Gahl > > Manager, Senior Software Engineer > > Nth Penguin, LLChttp://www.nthpenguin.com > > -- > > Architect > > WebWidgetry.com / MashupStudio.com > > Future Home of the World''s First Complete Web Platform > > -- > > Inquire: 1-262-951-6727 > > Blog:http://www.someElement.com > > > > >-- Ryan Gahl Manager, Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com -- Architect WebWidgetry.com / MashupStudio.com Future Home of the World''s First Complete Web Platform -- Inquire: 1-262-951-6727 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Take a look at this : http://livepipe.net/projects/object_event/ That may help 8P. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I was just about to suggest that as well. I haven''t looked at it myself, but I just saw it get pushed to me via the Ajaxian RSS feed. - Dash - jdalton wrote:> Take a look at this : http://livepipe.net/projects/object_event/ > That may help 8P. > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Well like everyone else here I''ve also created a custom event class. If you would like to take a look at my approach, a blog including code can be found here http://positionabsolute.net/blog/2007/06/event-dispatcher.php I tried to create an abstract class that my implementation specific classes could inherit from. I also adhered to ActionScript''s EventDispatcher class in terms of public methods, so anyone familiar with that model will be able to easily adopt. Cheers --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---