On 9/14/06, Bob Ippolito <[EMAIL PROTECTED]> wrote:
> On 9/14/06, Juergen Schreck <[EMAIL PROTECTED]> wrote:
> > Ok, it works when I write it like this:
> >
> > var controller = {
> >  dispatch: function ( foo, bar, baz ) {
> >  return window[foo][bar](baz);
> >  }
> > }
> >
> > Now for style... Is the above a 'proper' way to do this?
>
> almost.
>
>     var obj = window[foo];
>     return obj[bar].call(obj, baz);
>
> or (using MochiKit):
>
>     return method(obj[foo], bar)(baz);

er, the latter should of course be:

    return method(window[foo], bar)(baz);

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

Reply via email to