Later found that such a document is very inconvenient to view, and listen to our boss said Phper can generate their documents, I think JS will also have a, so ... You know... Through the @ Guangzhou ♂lxrmido know JSDoc, so GitHub down on down; Attached address: Https://github.com/jsdoc3/jsdoc
He can let your JS generate HTML documents, such as:
The code is as follows |
Copy Code |
/** * opens a new window * @param {string} [url] connection * @param {object} [options] configuration parameter * @retu RN {Object} MSC object * @example * 1, Msc.open ("/"), * 2, Msc.open ("/", { * width:1000, * height:300 *}); */www.111cn.net function open (URL, options) { var str = ""; if (options) { options.height = options.height | | 420 ; options.width = options.width | | 550; options.left = Options.left | | ((screen.width-options.width)/2); The default is centered options.top = Options.top | | ((screen.height-options.height)/2); The default is centered for (var i in options) { str + = ', ' + i + ' = ' + options[i]; } str = STR.SUBSTR (1); }; window.open (URL, ' connect_window_ ' + (+new Date), str); str = NULL; return MSC; }; |
Using JSDoc can be resolved into, file, method name, parameters, examples, return value author, and so on information, and have directory index and source code. It's pretty awesome. Figure:
And this is just the tip of her function, more multi-functional to your excavation, I also just know, do not dare to hide, so share!
Note: What questions can be answered Ah, we study/discuss
I was installed with the CNPM in node (NPM knows it all)
CNPM Install Jsdoc-g
Then use CMD to carry out the required directory, directly
JSDoc Xl.js
JSDoc Directory Name
Run, she will generate out folders in the same directory, and then you'll open it. Note: Your comments must go according to the standard, I used the sublime Docblockr PS: Standard annotation will make our future work more handsome more parameter description please see GitHub, or official website http://usejsdoc.org/