<tfoot id='iCuab'></tfoot>
  • <legend id='iCuab'><style id='iCuab'><dir id='iCuab'><q id='iCuab'></q></dir></style></legend>

          <bdo id='iCuab'></bdo><ul id='iCuab'></ul>
      1. <small id='iCuab'></small><noframes id='iCuab'>

      2. <i id='iCuab'><tr id='iCuab'><dt id='iCuab'><q id='iCuab'><span id='iCuab'><b id='iCuab'><form id='iCuab'><ins id='iCuab'></ins><ul id='iCuab'></ul><sub id='iCuab'></sub></form><legend id='iCuab'></legend><bdo id='iCuab'><pre id='iCuab'><center id='iCuab'></center></pre></bdo></b><th id='iCuab'></th></span></q></dt></tr></i><div id='iCuab'><tfoot id='iCuab'></tfoot><dl id='iCuab'><fieldset id='iCuab'></fieldset></dl></div>
      3. 使用 jsdoc 记录匿名对象和函数的最佳方式

        时间:2023-07-31

          <tfoot id='kflcp'></tfoot>

          <small id='kflcp'></small><noframes id='kflcp'>

          • <i id='kflcp'><tr id='kflcp'><dt id='kflcp'><q id='kflcp'><span id='kflcp'><b id='kflcp'><form id='kflcp'><ins id='kflcp'></ins><ul id='kflcp'></ul><sub id='kflcp'></sub></form><legend id='kflcp'></legend><bdo id='kflcp'><pre id='kflcp'><center id='kflcp'></center></pre></bdo></b><th id='kflcp'></th></span></q></dt></tr></i><div id='kflcp'><tfoot id='kflcp'></tfoot><dl id='kflcp'><fieldset id='kflcp'></fieldset></dl></div>
            <legend id='kflcp'><style id='kflcp'><dir id='kflcp'><q id='kflcp'></q></dir></style></legend>
                <tbody id='kflcp'></tbody>
                <bdo id='kflcp'></bdo><ul id='kflcp'></ul>
                • 本文介绍了使用 jsdoc 记录匿名对象和函数的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  从技术上讲,这是一个两部分的问题.我选择了涵盖一般问题的最佳答案,并链接到处理特定问题的答案.

                  This is technically a 2 part question. I've chosen the best answer that covers the question in general and linked to the answer that handles the specific question.

                  用 jsdoc 记录匿名对象和函数的最佳方法是什么?

                  What is the best way to document anonymous objects and functions with jsdoc?

                  /**
                   * @class {Page} Page Class specification
                   */
                  var Page = function() {
                  
                      /**
                       * Get a page from the server
                       * @param {PageRequest} pageRequest Info on the page you want to request
                       * @param {function} callback Function executed when page is retrieved
                       */
                      this.getPage = function(pageRequest, callback) {
                      }; 
                  };
                  

                  代码中既不存在 PageRequest 对象,也不存在 callback.它们将在运行时提供给 getPage().但我希望能够定义对象和函数是什么.

                  Neither the PageRequest object or the callback exist in code. They will be provided to getPage() at runtime. But I would like to be able to define what the object and function are.

                  我可以通过创建 PageRequest 对象来记录:

                  I can get away with creating the PageRequest object to document that:

                  /**
                   * @namespace {PageRequest} Object specification
                   * @property {String} pageId ID of the page you want.
                   * @property {String} pageName Name of the page you want.
                   */
                  var PageRequest = {
                      pageId : null,
                      pageName : null
                  };
                  

                  这很好(尽管我愿意接受更好的方法来做到这一点).

                  And that's fine (though I'm open to better ways to do this).

                  记录 callback 函数的最佳方式是什么?我想在文档中说明一下,比如回调函数的形式是:

                  What is the best way to document the callback function? I want to make it know in the document that, for example, the callback function is in the form of:

                  callback: function({PageResponse} pageResponse, {PageRequestStatus} pageRequestStatus)
                  

                  任何想法如何做到这一点?

                  Any ideas how to do this?

                  推荐答案

                  您可以使用@name 标签记录代码中不存在的内容.

                  You can document stuff that doesnt exist in the code by using the @name tag.

                  /**
                   * Description of the function
                   * @name IDontReallyExist
                   * @function
                   * @param {String} someParameter Description
                  */
                  
                  /**
                   * The CallAgain method calls the provided function twice
                   * @param {IDontReallyExist} func The function to call twice
                  */
                  exports.CallAgain = function(func) { func(); func(); }
                  

                  这里是 @name 标签文档.您可能会发现 名称路径 也很有用.

                  Here is the @name tag documentation. You might find name paths useful too.

                  这篇关于使用 jsdoc 记录匿名对象和函数的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:document.getElementsByTagName 不起作用 下一篇:元素开始标签内的 HTML 注释

                  相关文章

                  <legend id='JvziR'><style id='JvziR'><dir id='JvziR'><q id='JvziR'></q></dir></style></legend>

                  <small id='JvziR'></small><noframes id='JvziR'>

                  1. <i id='JvziR'><tr id='JvziR'><dt id='JvziR'><q id='JvziR'><span id='JvziR'><b id='JvziR'><form id='JvziR'><ins id='JvziR'></ins><ul id='JvziR'></ul><sub id='JvziR'></sub></form><legend id='JvziR'></legend><bdo id='JvziR'><pre id='JvziR'><center id='JvziR'></center></pre></bdo></b><th id='JvziR'></th></span></q></dt></tr></i><div id='JvziR'><tfoot id='JvziR'></tfoot><dl id='JvziR'><fieldset id='JvziR'></fieldset></dl></div>

                      <tfoot id='JvziR'></tfoot>

                        <bdo id='JvziR'></bdo><ul id='JvziR'></ul>