【问题标题】:JSDoc prints nothingJSDoc 不打印任何内容
【发布时间】:2015-10-22 16:56:35
【问题描述】:

我有下一个代码

element.js

(function(){

        /**
         * Element builder
         * @param {string} url
         * @constructor
         **/
        element = function(url){
                /**
                 * Web service url
                 * @type {string} Url service
                 * @private 
                 */
                this._url = url;
        };

        /**
         * Open web service 
         * @param {Object} param
         **/
        element.prototype.open = function(param){
        };
})();

我正在尝试测试 js 文档并获取一些关于我的代码的文档。

我运行下一个命令

jsdoc --debug element.js

我收到了下一条消息

DEBUG: JSDoc 3.3.2 (Sat, 13 Jun 2015 22:20:28 GMT)
DEBUG: Environment info: {"env":{"conf":{"tags":{"allowUnknownTags":true,"dictionaries":["jsdoc","closure"]},"templates":{"monospaceLinks":false,"cleverLinks":false,"default":{"outputSourceFiles":true}},"source":{"includePattern":".+\\.js(doc)?$","excludePattern":"(^|\\/|\\\\)_"},"plugins":[]},"opts":{"_":["element.js"],"debug":true,"destination":"./out/","encoding":"utf8"}}}
DEBUG: Parsing source files: ["/home/ismael-trabajo/Escritorio/js/element.js"]
Parsing /home/ismael-trabajo/Escritorio/js/element.js ...WARNING: The @type tag does not permit a description; the description will be ignored. File: element.js, line: 9
WARNING: The @type tag does not permit a description; the description will be ignored. File: element.js, line: 14
complete.
DEBUG: Finished parsing source files.
DEBUG: Indexing doclets...
DEBUG: Adding inherited symbols, mixins, and interface implementations...
DEBUG: Adding borrowed doclets...
DEBUG: Post-processing complete.
Generating output files...complete.
Finished running in 0.31 seconds.

输出是index.html,空文件。我做错了什么?

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Home</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Home</h1>
    <h3> </h3>
</div>

<nav>
    <h2><a href="index.html">Home</a></h2>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.2</a> on Tue Sep 08 2015 15:35:49 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

谢谢大家!

【问题讨论】:

    标签: javascript jsdoc


    【解决方案1】:

    我为此找到的解决方案是使用命名空间。

    /**
     * Handles elements
     * @namespace myNameSpace
     */
    (function(){
    
        /**
         * Element builder
         * @param {string} url
         * @constructor
         * @memberof myNameSpace
         **/
        element = function(url){
            /**
             * Web service url
             * @type {string} Url service
             * @private
             */
            this._url = url;
        };
    
        /**
         * Open web service
         * @param {Object} param
         * @memberof myNameSpace
         **/
        element.prototype.open = function(param){
        };
    })();
    

    【讨论】:

    • 我会对此进行测试,如果它对我有用,我会评论你。
    • 但是为什么这行得通?因为只是在不需要的东西上打一个命名空间并不是超级有用的信息......
    猜你喜欢
    • 2019-05-26
    • 2021-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    • 2016-05-02
    相关资源
    最近更新 更多