I would like to create a factory.js file that has an init method that
accepts an attribute of which library to load.

So say I had a string library called string.js and a library called
date.js.  I would like to include one default.js file in the site and
dynamically load up the functions from string.js and/or date.js via an
init method.  Basically I want to load all libraries into one
(factory.js) file.

So say I had a function customSplitString(myString, delim) in string.js
and a createCustomDate(month, day, year) function in date.js.  Now I
want someone to be able to write a function in their CFML that calls
these functions.  Here are a few examples:

Inline in CFML. This example should only load date.js
<script>
        Function createSomeDate()       {
                Var myDateMonth=2;
                Var myDateYear=2007;
                Var myDateDay=1;
                Return factory.date.createCustomDate(myDateMonth,
myDateYear, myDateDay);
        }
</script>

Inline in CFML. This example should only load string.js
<script>
        Function returnMyName(myName, delim)    {
                Var myNameArr=factory.string.customSplitString(myString,
delim);
                Return myNameArr.length();
        }
</script>

Inline in CFML This example would load string and date.

<script>
        Function returnMyName(myName, delim)    {
                Var myNameArr=factory.string.customSplitString(myString,
delim);
                Return myNameArr.length();
        }
        Function createSomeDate()       {
                Var myDateMonth=2;
                Var myDateYear=2007;
                Var myDateDay=1;
                Return factory.date.createCustomDate(myDateMonth,
myDateYear, myDateDay);
        }
</script>

So in the end nobody would call the string or date libraries
independently. There would only be one script include in the header of
the application that loads factory.js.

I've done this years ago but I can't remember how I did it.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299142
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to