Phenomenon:

when you use the Appeon Debugger to debug your application, you may run into the kind of issue like “Appeon Debugger cannot correctly load the JS file since it is over 500KB in size…” as shown below.

Analysis:

This issue is occurring on some of the operation systems such as Windows XP SP3 and Windows Vista, etc. However, during our testing, in Windows XP SP2 and Windows 2003 R2 Standard Edition, the user can debug a *.js file of 2.7MB in an application.  

Solutions:

Solution 1: You can perform test on another operation system like Windows XP SP2 if possible.

Solution 2: Restructure code to reduce the size of the application.js and deploy the application in “Debug JS” mode only.

If customer really wants to use the Appeon Debugger, then they would need to restructure their application object so it will reduce the size of the corresponding application.js to be less than 500KB.  But before embarking on this task, the customer should first make sure of two things:

1) that the application is deployed in “Debug JS” mode only.  They should NOT use “Debug JS/PS” mode with Appeon Debugger, as this will make the file size bigger.  

2) they should check to see if any other .JS files are over 500KB (simply browse the Web root folder and sort by file size).  In most cases, the only file that should be over 500KB is the application.js. 

So how to reduce the size of the application.js?  First make sure that there is not excessive amount of script coded in any events of the application object, such as “open” event.  You can copy n’ paste the script into notepad to see how much disk space the lines-of-code consumes.  Aside from this, another common culprit are global functions.  The larger these are will directly increase the size of the application.js, because all of this is stored in the application.js file upon Web conversion.  As much code as possible needs to be moved out of the application object to keep it light. 

The way to move code from the events of the application object and global functions is to package them into global user objects.  By packaging it into user objects it moves it out of the application.js, and by making the user object global, it is available to the entire application.  Depending on how much the application.js exceeds the 500KB limit, customer may only need to reduce a couple global functions or several hundred lines of code to get below the threshold, but ideally they should move them all and split them into multiple user objects.  If multiple user objects are not used, then you run the risk that a single userobject_name.js will exceed 500KB.  Another suggestion is removing comments or any unused code from the events and global functions to trim down the size. 

This requires customer to invest time to restructure code, but for sure, the application.js can be trimmed down.  If customer does not want to do this work, then the other choice would be to use a third-party JavaScript debugger, such as VisualStudio or InterDev.  

0
1