[Prototype-core] Multiple eventName's for Event observe?

2009-10-22 Thread Ngan Pham
It would be nice if Event#observe's eventName argument was able to take an
array, or perhaps a comma delimited string so that it can attach to multiple
events in one call:
Event.observe(something, 'keyup,mouseup', this.blah.bind(this));
or
Event.observe(something, ['keyup', 'mouseup'], this.blah.bind(this));

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: Multiple eventName's for Event observe?

2009-10-22 Thread Allen Madsen

I would prefer something more like this:
http://gist.github.com/166475

I think it is a rare use case that you would apply the same action to
many events on the same object. However, I think it is much more
common to apply multiple actions to events on the same object at one
time.

Of the two solutions you mention though, I would prefer the first.

Allen Madsen
http://www.allenmadsen.com



On Thu, Oct 22, 2009 at 1:50 PM, Ngan Pham nganp...@gmail.com wrote:
 It would be nice if Event#observe's eventName argument was able to take an
 array, or perhaps a comma delimited string so that it can attach to multiple
 events in one call:
 Event.observe(something, 'keyup,mouseup', this.blah.bind(this));
 or
 Event.observe(something, ['keyup', 'mouseup'], this.blah.bind(this));
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---