如何使用 jsdoc-toolkit 记录匿名函数(闭包) [英] How to document anonymous functions (closure) with jsdoc-toolkit

查看:26
本文介绍了如何使用 jsdoc-toolkit 记录匿名函数(闭包)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 JSDoc-toolkit 来记录我的代码.我的代码首先被一个自动执行的匿名函数包装起来.我到底如何记录这个?我几乎花了一整天的时间在这上面.JS Docs 不会识别匿名函数闭包中的任何内容,因为它不知道如何处理它.它打破了,我的评论都没有通过.

I am trying to document my code using JSDoc-toolkit. My code starts by being wrapped with a self-executing anonymous function. How in the world do I document this? I've spent nearly all day on this. JS Docs will not recognize anything inside of the anonymous function closure due to it not knowing what to do with it. It breaks and none of my comments come through.

我的代码看起来像这样.

My code looks something like this.

/** 
 * @fileoverview BLA BLA BLA
 */

/**
 * This is where I don't know what to put.
 */
 (function () {
     "use strict";

     /** or here */
     var stlib = function (param, param, param) {
         /** or here */
         var share = {
             /** or here */
             config: {
                 button: DOM Element,
                 property: blablabla
             },

             init: function () { ...some init code here}
         };

         share.init();
     };

     widgets.add("share", stlib);
 }());

谢谢!

推荐答案

你可以像这样使用@namespace 和@name 和@lends:

You can use @namespace with @name and @lends like this:

/**
* @name MyNamespace
* @namespace Hold all functionality
*/
(function () {
    "use strict";
    /** @lends MyNamespace*/
    var stlib = function (param, param, param) { ...All of my code...};
}());

这篇关于如何使用 jsdoc-toolkit 记录匿名函数(闭包)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆