Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
404 views
in Technique[技术] by (71.8m points)

shared libraries - Google Apps Script Auto Generated Library Documentation

I am currently developing a Library for Google Apps Script that basically treats a spreadsheet as a database object.

Currently, the library has a two identical functions like

/** * Opens and creates a query object for a spreadsheet with the given url. * * @param {String} the url of the spreadsheet * @return {SpreadsheetQuery_} a spreadsheet query object for the given spreadsheet */ function openByUrl(url) { return new SpreadsheetQuery_(SpreadsheetApp.openByUrl(url)); }

now, for the two public functions, the documentation generated only shows the return type and not the parameter nor the instructions attached. I am assuming this is a google issue and not really bothered.

But my main question is this, as the functions are instantiating an object from the private function, how can I get the auto documentation to show methods that exist on that object. All the functionality will be provided by the object and it will be great if GAS could show the methods on it.

NOTE


The methods are all placed on the prototype of the function. eg.

SpreadsheetQuery_.prototype.from = function (sheet) {
    if (_.isNumeric(sheet)) {
        ....
}

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...