The code I presented is the same monolith file I edited. I want to access those methods with a different file.
On Jul 26, 1:41 pm, Xavier MONTILLET <[email protected]> wrote: > I don't get it... > You code has nothing but the namespace in common with the main file... > And if you assign a new value to APP then the main file becomes useless... > On Jul 26, 2011 7:30 PM, "Wilkins" <[email protected]> wrote: > > > > > > > > > The project I'm working on has an enormous JS file that I didn't want > > to add to. I wanted to access some of the methods defined, so I > > created an adapter file that would load "after" (minfied + combined) > > the main file. > > > Here is how the original would look: > > var APP = APP || {}; > > APP = { > > stuff : { > > doStuff : function(){}, > > doStuffAgain : function(){} > > }, > > moreStuff : { > > doMoreStuff : function(){} > > } > > }; > > > In order to access it's methods, I returned it as an object like this: > > var APP = APP || {}; > > APP = (function() { > > return { > > stuff : { > > doStuff : function() { > > }, > > doStuffAgain : function() { > > } > > }, > > moreStuff : { > > doMoreStuff : function() { > > } > > } > > // etc > > }; > > })(); > > > It seems to work fine. I have access to everything I need in my > > adapter. However, there were never any tests written, so I'm not 100% > > sure EVERYTHING will work. > > Are there any obvious downsides in doing something like this? > > > -- > > To view archived discussions from the original JSMentors Mailman list: > > http://www.mail-archive.com/[email protected]/ > > > To search via a non-Google archive, visit here: > > http://www.mail-archive.com/[email protected]/ > > > > > > > > > > > To unsubscribe from this group, send email to > > [email protected] -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
