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));
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.
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));
> 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.
> 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));