jQuery插件文档与JSDoc

jQuery plugin documentation with JSDoc

本文关键字:JSDoc 文档 插件 jQuery      更新时间:2023-09-26

我想知道如何通过使用JSDoc记录jQuery插件?我的代码是:

   /**
     * The default configurations of comments
     * @typedef {Object} CommentConfig
     ...
     */
   /**
     * Show comments
     * @method comments
     * @version 1.0.1
     * @param {CommentConfig} options Configuration of comment
     */
    $.fn.comments = function (options) {
        // ..
    }

我想让@method$.fn.comments,但它不起作用

根据JSDoc3文档,您应该在您的情况下使用@external:

/**
 * The jQuery plugin namespace.
 * @external "jQuery.fn"
 * @see {@link http://docs.jquery.com/Plugins/Authoring The jQuery Plugin Guide}
 */
/**
 * Show comments
 * @function external:"jQuery.fn".comments
 */