Writing jsdoc documentation on methods inside a class

纵饮孤独 提交于 2019-12-18 09:03:28

问题


I am writing some libraries in Google Apps Script and I am trying to document them. I have written some classes in the format below, and the comments of methods inside the class don't show up in the documentation :

/**
* My comments here
*/
function MyBeautifulObject(){

   this.myMethod=myMethod;
   ....

   /**
   * This comment doesn't show up
   */

   function myMethod(){
     ...
   }

}

Any idea on how I could achieve this ?


回答1:


This question may be a duplicate... this answer certainly is.

The jsdoc variant suported for libraries in Google Apps Script does not support documentation at the level you are looking for, only first-level functions. There is a relevant open bug report on this, but no response from Google.

You can still write your jsdoc tags, and generate your documentation outside of the Google infrastructure. Take a look at How to preview jsdoc comments in google doc scripts for some pointers on how to preview your jsdoc comments. You could take the output of jsdoc3 and publish it on a site to provide your docs to your community.

Other relevant / possible duplicate posts:

  • Creating a namespace-like organization in a google apps script library
  • Google Apps Script Auto Generated Library Documentation



回答2:


If you are working with TypeScript, we've built a package that aims help on this:

https://github.com/maelcaldas/clasp-types

We use it to generate autocomplete for our OO libraries and Client-side API written on Typescript.



来源:https://stackoverflow.com/questions/14893927/writing-jsdoc-documentation-on-methods-inside-a-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!