Closed shredtechular closed 8 years ago
This is fairly large for a PR. Would it be possible to break this up into multiple PRs? I see a potential breakup like
It looks like you're doing this already, but just want to make sure we're going by the Google JS Style Guidelines. This isn't a Google project, but it doesn't look like the original code has any consistent style guidelines applied and the M-Lab team is most familiar with the Google JS style guide.
I love the added documentation on functions that didn't have it. Thanks for adding that!
Review status: 0 of 3 files reviewed at latest revision, 4 unresolved discussions.
HTML5-frontend/ndt-library.js, line 6 [r1] (raw file):
* utilize. The NDT object is self invoked when the library is included on a * page, however, the frontend can customize certain properties when the * interaction is initialized with the startTest method.
Trailing whitespace on this line. This seems to repeat a few times in the PR. Can we grep to catch all of them?
HTML5-frontend/ndt-library.js, line 13 [r1] (raw file):
/** * Immediately Invoked Function Expression that creates NDT library object
Only first word should be capitalized
HTML5-frontend/ndt-library.js, line 95 [r1] (raw file):
* Creates the backend for the NDT object. Tries to create websocket backend * if supported, falls back to java applet if websocket not available * @param - none
Does JSDoc require us to document lack of a parameter? (ditto throughout)
HTML5-frontend/script.js, line 504 [r1] (raw file):
/** * Parses, formats, and displays final summary of diagnostic information for NDT test
Can we limit comments to 80 columns?
Comments from Reviewable
I have broken this PR into 2 PRs to hopefully more clearly show the changes being made and why.
Also, to answer your question, yes, I was definitely trying to follow the Google JS Style Guide, but I think you did find a few things that I missed.
Review status: 0 of 3 files reviewed at latest revision, 4 unresolved discussions.
HTML5-frontend/ndt-library.js, line 6 [r1] (raw file):
This is fixed now in PR #54 and have my editor setup now to remove trailing whitespace whenever I save now, so hopefully this should never be an issue in my code anymore!
HTML5-frontend/ndt-library.js, line 13 [r1] (raw file):
Fixed now in PR #54
_HTML5-frontend/ndt-library.js, line 95 [r1] (raw file):_
I removed it in PR#54. I thought it would be nice to show that, but you are probably right that its unnecessary
HTML5-frontend/script.js, line 504 [r1] (raw file):
Good catch, I missed this. Fixed in PR #55
_Comments from Reviewable_
Closing out in favor of #55.
This PR is the first step at separating out the Frontend and Backend functionality that exists today in the NDT client as discussed in https://github.com/m-lab/m-lab.github.io/issues/102 on the MLab website. The idea is to ease how an implementer might include an NDT js library onto their website and by including only the necessary js, an implementer could create their own frontend using the NDT js library.
As the current implementation would require a website to include five different scripts, this PR starts to address that breaking up the script.js file into frontend and backend functionality. This removes the dependency for an NDT js library to need jQuery, the gauges.min.js library, or the script.js file. Those files would ONLY be needed if a user wanted the NDT frontend that exists on the site today, but not if it was creating a custom frontend.
Other implementation notes:
NDT
object. For example, to trigger the start of a test, a developer can now simply writeNDT.startTest()
in their own frontend code. Similarly, to get the status of a test, a developer can now simply writeNDT.testStatus()
, and etc.Items this PR does NOT address:
Other Enhancements that could be done here:
This change is