Mikhus/canv-gauge — pull request #14 by rwblackburn (2013-06-07 18:30:49+00:00)
Title: Switch to Google Closure?

Hi, I am submitting this change simply as a suggestion. I was getting some odd validation messages in my IDE which is what lead me down this path. I am not sure if you want to go down the road of Google Closure, so I am submitting this pull request as a method of opening up the discussion. Feel free to close this if you do not feel this is a good change for the project.

The changes include…
-----------------------------------------------------------------------------------------------
Added the closure compiler, and made the necessary changes to allow this to be compiled with SIMPLE_OPTIMIZATIONS settings. The new min file is roughly the same size as the old (10957 vs. 11758). However this new version does not require an eval() to process the script and enables us to use source mapping to make debugging the compiled version of the script easier. Simply add this line to the end of the gauge.min.js files to enable source mapping:
//@ sourceMappingURL=gauge.min.js.map
You will also need to turn this feature on in the browser’s debugger too, see this article for more information: http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/

To make compiling easier I have added a build.bat file too. Simply execute this and a new gauge.min.js and gauge.min.js.map files will be generated. Verbose mode is enable, so compiler warning will be displayed. It’s always good to clean those up, even if they are not preventing the script from running. I resolved all but four of these. The ones I resolved included a missing var scope and missing radix parameters in the parseInt() function (which can cause some odd stuff in older browsers which did not use 10 as the default). The ones I did not resolve are places accessing the this variable at suspicious locations. I did not change these because I was not entirely sure what this part of the script was doing, and did not want to break something inadvertently.