JSDoc无法输出任何内容

4

I have the next code

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 doc并获取有关我的代码的文档。

我运行以下命令:

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>

感谢大家!(Thank you all !)
1个回答

8
我找到的解决方案是使用命名空间。
/**
 * 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){
    };
})();

我会测试一下,如果对我有用的话,我会给你评论。 - Ismael Moral
1
但是,为什么会这样呢?因为在不需要的情况下简单地对某些东西添加命名空间并不是非常有用的信息... - Mike 'Pomax' Kamermans

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接