On Dec 12, 7:20 pm, Arnar Birgisson <[email protected]> wrote:
> Hi
>
> On 12.12.2008, at 16:45, Eoghan <[email protected]> wrote:
>
> > connectEach($$('#my-ul li'), 'onclick', function(e){
> > // do sumn'
> > });
>
> > rather than slightly more unwieldy:
> > forEach($$('#my-ul li'), function(el){
> > connect(el, 'onclick', function(e){
> > // do sumn'
> > });
> > });
>
> > Is it a good candidate to include in the signal api?
>
> I can definitely see the use case, but IMO this is one of the cases
> where I'd not want to add since forEach is not that much typing. In my
> mind this the whole point of having a functional, composable API such
> as the iter module.
>
> Just my 2000 ISK
>
> cheers,
> Arnar
I agree.
After consideration of generalisation, maybe what I'm looking for is a
version of `partial` that can take out of order arguments, something
along the following lines:
forEach($$('#my-ul li'), partial(connect,
MochiKit.Base.placeholder, 'onclick', function(e){
// do sumn'
}));
Although I'm not sure what the implementation of partial would look
like in order to support out of order placeholder arguments...
Eoghan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---