On Fri, Dec 12, 2008 at 11:20 AM, 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

Personally I think it's useful, but I would rather have the connect
take a selector as a string instead of a list. Makes it much easier to
track down when the lookup happens in-connect.

connectAll("#my-ul li", "onclick", ...);

(not sold on the name)

We could even have the existing API do this if passed a list, but
perhaps that's a bit too magical.

connect(["#my-ul li"], "onclick", ...);

The other problem is that the return signature has to change for
disconnect, or we have to allow for a different kind of disconnect.

-bob

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to