JavaScript Files for HotDocs Server Are Larger

From HotDocs Wiki

Jump to: navigation, search


The JavaScript files generated for HotDocs Server implementations are significantly larger for later releases than they were for early releases, like HotDocs 6.2.


Prior to HotDocs Server 2005, a template's components AND its interview logic were defined in a series of function calls ("AddHDDoc" and "AddHDVar", if you look in the .js files). The interview logic was defined in the ordering of the calls and the particulars of each call; there was no separation between the components and interview logic. This approach worked okay when the entire interview was displayed on a single page, but it also made it very difficult to limit the amount of processing the JavaScript had to do keeping the interview (and all dialogs in it) up to date as answers were modified. It also made it difficult to show and process a single dialog at a time in a way that would perform faster. Lastly, it made adding features like repeat spreadsheets, dialog layouts, WHILE instructions, etc. very difficult or impossible.

In HotDocs Server 2005, we continued to emit component definitions as a series of similar function calls, but we began converting the interview logic into a JavaScript function (much the same as we were already converting other HotDocs scripts into JavaScript functions). This allowed the JavaScript-based interviews to begin approaching the desktop version of HotDocs in the features they offered -- display and updating of an interview outline, interviews that presented one dialog at a time, and in most cases also provided better performance on the same hardware. It was also a much more solid foundation upon which to build new features.

The downside in this case, though, is that templates that have a very large HotDocs interview get translated into JavaScript that has a very, very large HDInterview function.