We have a pretty large amount of javascript that is in some of the apps we
are doing. Most of the functions are conditional and not all will be used
in every scenario, but they all need to be accessible to the page. A good
deal of the functions need to hit a hidden frame to perform queries and
return specific information. Basically what we were developing were huge
blocks of javascript functions inside of our fusebox pages that could
potentially take a good deal of time to trouble shoot ... seemed to counter
the simplicity of a fusebox app.
Soooo came up with the idea of creating a jsp directory inside the fuse to
store jsp_whatever.cfm where a jsp_ page stores a single javascript
function. All we need now is this function:
function CallJavaScript(x) {
Location =
"index.cfm?FuseAction=CallJavaScript&<cfoutput>#client.urltoken#</cfoutput>&
Function=" + x;
parent.JavaScriptFrame.location = Location;
}
it hits the hidden frame and calls the necessary function that does whatever
processing on the parent frame we need. A function can even call additional
functions as needed. When we hit the CallJavaScript value in our main
switch statement we simply open another switch that checks
attributes.Function and calls the appropriate jsp_ file.
This works great and keeps the code manageable and more fusebox like ...
however it also generates additional hits to the server and somewhat negates
the beauty of the true client side pre-processing. I was wondering if
anyone had any opinions or concerns about this method of doing this or any
ideas about how this might slow down an application in a production
environment.
Thanks!
Kevin Bridges
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists