APP is public so his properties are too...
But if you want to acces something APP's methods use but that aren't
referenced in APP itself, you just can't.
If i were you, i would insert my code just before the end of the closure.
On Jul 26, 2011 7:57 PM, "Wilkins" <[email protected]> wrote:
> Nah. If I were to use the original version, it's all wrapped up in a
> closure, so I can't access anything using an outside file.
>
>
> On Jul 26, 1:44 pm, "David Marrs" <[email protected]> wrote:
>> You should have had access to the APP methods in the unmodified example.
&nbsp;You couldn't just call&nbsp;APP.stuff.doStuff() in your code? Or am I
missing something here?
>>
>> On 26 Jul 2011 18:30, Wilkins &lt;[email protected]&gt; 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]

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

Reply via email to