it has 4 important roles: 1. It provides a private scope for the library, as to not pollute the global scope. 2. It allows for much better scope management - if i pass a different variable to instead of window, it will be namespaced 3. It allows a cross-library syntax without missing the useful $ shortcut 4. it provides protection from undefined overwrite
about the bond - yeah - i prefer not using it when i can leave it. plus, it's much easier to maintain scope resolution this way. about inconsistency- you're right ofcourse... this is probably legacy code (i do change my coding styles once in a while...) 10x for the comments :) On Thu, Aug 19, 2010 at 9:59 PM, Rolf -nl <[email protected]> wrote: > why/what is this: > > (function(window,$,undef){ > window['ThumbsSlides'] = new Class({ > ... > }(this,document.id)); > > ? > > And AJAXThumbs has this: > > (function($){ > AJAXThumbs = new Class({ > > ? > > I see you're not a fin of .bind(this) - hehe.. it's a little > inconsistent though, sometimes its _self, other times $this > > Anyway- nice.. I'm doing a tiny thumbgrid thing for a project atm and > it's always nice to see how others do it. > I agree with your post btw, but I assumed most Forge plugs were solid > (but I haven't checked them all out you know). > > Cheers > > > On Aug 19, 6:52 am, אריה גלזר <[email protected]> wrote: > > On Wed, Aug 18, 2010 at 11:54 PM, Thomas Aylott > > <[email protected]>wrote: > > > > > Awesome, > > > Put it up on The Forge? > > >http://mootools.net/forge/ > > > > way <http://mootools.net/forge/p/thumbsslides> ahead of > > you<http://mootools.net/forge/p/slbox> > > ... > > > > -- > > Arieh Glazer > > אריה גלזר > > 052-5348-561 > > 5561 > -- Arieh Glazer אריה גלזר 052-5348-561 5561
