...
Using the JSDoc plugin hosted on ServoyForge it is also possible to generate HTML documentation of the JavaScript code in a Solution, based on the JSDOc supplied.
Stoc |
---|
The JSDoc syntax consists of a set of JSDoc tags, contained in JSDoc comments.
...
Code Block |
---|
/** * A simple demo function that outputs some text * @author Tom * @private * * @param {String} text The text that will be written to the output * @throws (String) * returns Boolean * * @example try { * saySomething('Hello world!'); * } catch(e) { * * } * * @see application.output * @since 1.0 * @version 1.0.1<br> * - Added some more JSDoc tags for the demo */ function saySomething(text) { if (text == null || text.length == 0) { throw "Invalid input!" } application.output(text); return true; } |
JSDoc is not a official standard, but the defacto standard is is defined by the JSDoc Toolkit project. The other major definer of JSDoc is Google Closure Compiler's support for JavaScript annotation.
...
See JSDoc Tags and Type Expressions below for the supported tags and their syntax.
As mentioned in the intro, the Script Editor in Servoy Developer utilizes JSDoc to improve the quality of code completion and validation.
...
Note that the Script Editor will always generate a JSDoc comment block with a @properties tag when saving the Script editor, if no JSDoc comments have been defined. The @properties tag is a tag containing information for Servoy to provide proper linking and versioning.
The following JSDoc tags are supported in the Script Editor. This means that the JSDoc tags will be rendered without the "@" sign when hovering over a reference tot he function or variable.
...
A file can be either a Form JavaScript file or the globals JavaScript file. Only Form can be extended, thus the @protected tag is not relevant for annotating variables and functions within the globals JavaScript file
Type Expressions are used to describe the type and/or structure of data in the following cases:
...
1 the value in between <..> is the datasource notation that is built up of the database server and tablename: db:/{serverName}/{tableName}
JSDoc can be used inside JavaScript code to specify the type of variables. This can be necessary if the correct type can't be automatically derived.
...