我有以下JavaScript。
这是一个RequireJS模块,其函数被命名为对象文字。我提到:How do I JSDoc A Nested Object's Methods?以了解如何标记JSDoc符号。
我在一个繁琐的任务中运行带有private: true
的JSDocs 3.3.0-beta3,但是在模块页面上没有publich方法的私有方法或参数。
/**
* A module doing a lot of Foo.
* @module Foo
* @requires jquery
* @author Markus Falk
*/
define(['jquery'], function($) {
'use strict';
/**
* @property {Object} Container
*/
var Foo = {
/**
* Caches all jQuery Objects for later use
* @function
* @private
*/
_cacheElements: function() {
this.$foo = $('.foo');
},
/**
* inits the app and returns the Message Text
* @function
* @public
* @param {Object} msg - The message.
* @param {string} msg.text - The message's Text.
* @param {string} msg.author - The message's author.
* @returns {String} Sentence with given message.text
*/
init: function(msg) {
this._cacheElements();
return "Say " + msg.text;
}
};
return /** @alias module:Foo */ {
/** init */
init: Foo.init
};
});
以下是此JSDoc代码的输出:
答案 0 :(得分:1)
尝试@function init
和@function _cacheElements
/**
* A module representing a Foo.
* @module Foo
* @requires jquery
* @author Markus Falk
*/
define(['jquery'], function($) {
'use strict';
/**
* @property {Object} Container
*/
var Foo = {
/**
* Caches all jQuery Objects for later use
* @function _cacheElements
* @private
*/
_cacheElements: function() {
this.$foo = $('.foo');
},
/**
* inits the app and returns the Message Text
* @function init
* @public
* @param {Object} msg - The message.
* @param {string} msg.text - The message's Text.
* @param {string} msg.author - The message's author.
* @returns {String} Sentence with given message.text
*/
init: function(msg) {
this._cacheElements();
return "Say " + msg.text;
}
};
return /** @alias module:Foo */ {
/** init */
init: Foo.init
};
});