Page History
...
Tag | Syntax & Examples | Context | Impact | Description | ||||||
---|---|---|---|---|---|---|---|---|---|---|
@AllowToRunInFind | @AllowToRunInFind | function | Determines if the function will be executes in FindMode when used as an event handler | Custom Servoy JSDoc tag to annotate a function that it can be run if the Form on which the function is ran is in FindMode | ||||||
@author | @author userName | function, variable | none | Indicates the author of the code | ||||||
@constructor | @constructor | function | This will show a different icon on the Script Outline view . besides that no further impactand suppresses warnings related to inconsistent return values when building in a fail-save to calling a constructor function without the new keyword |
| ||||||
@deprecated | @deprecated description | function, variable | Accessing a deprecated variable or calling a deprecated function will produce a builder marker in Servoy Developer | Indicates that the function or variable is obsolete or has been replaced and should be used anymore. | ||||||
@enum | @example@enum | function, variablevariable | none | Tag allowing to provide some sample code how to use the function or variable. Multiline content is possible by including "<br>" as line-breaks behind each line of content. | @override | @override | functions, variables | none | Tag to describe that the function is overriding a similar in scripting, but Servoy Relations | Variables that contain a JavaScript Object with key/value pairs and tagged as enumeration using the @enum tag are handled special for Servoy relations: In the relation editor allows selecting one of the keys of the object as value for the primary 'key' in a relation items |
@example | @example | function, variable | none | Tag allowing to provide some sample code how to use the function or variable. Multiline content is possible by including "<br>" as line-breaks behind each line of content. | ||||||
@override | @override | functions | none | Tag to describe that the function is overriding an equally named function on a super form | ||||||
@param | @param {Type} name parameterDescription | function | Builder markers will be generated in Servoy Developer if the function is called with values for the parameters that do not match the specified types | Describe function parameters. | ||||||
@public | @public | function, variable | Explicitly marks a member as public API. | A member that is not marked as either public, private or protected is implicitly considered as public. Cannot be used in combination with @private or @protected | ||||||
@private | @private | function, variable | Accessing a private variable/function from outside the scope in which it is declared will generate a builder marker in Servoy Developer | Annotates a variable or function as accessible only from within the file in which it is declared Cannot be used in combination with @public or @protected | ||||||
@protected | @protected | function, variable | Accessing a protected variable/function from outside the scope in which it is declared or a child scope will generate a builder marker in Servoy Developer | Annotates a variable or function as accessible from within the same file in which it is declared and all files that extend this filefile Cannot be used in combination with @public or @private | ||||||
@return | @return {Type} | function | The specified type is used by the build process to determine the correctness of the code that uses the returned value and offer Code Completion | Annotates the type of the returned value. | ||||||
@returns | @returns {Type} | function | see @return | alias for @return | ||||||
@see | @see seeDescription | function, variable | none | Tag to provide pointers to other parts of the code that are related | ||||||
@since | @since versionDescription | function, variable | none | Tag to provide information about in which version of the code the variable or function was introduced | ||||||
@SuppressWarnings | @SuppressWarnings ([deprecated], [hides], [wrongparameters], [undeclared], [unused], [nls]) | function | Stop the generation of builder markers in Servoy Developer for the specified warnings | function | Stop the generation of builder markers in Servoy Developer for the specified warnings
| Custom Servoy JSDoc tag to suppress builder markers of a certain type within a function. | ||||
@this | @this {Type} | function | The specified type is used by the build process for the "this" object available inside functions to determine the correctness of the code that uses the object and offer Code Completion | Tag to specify the type of the "this" object inside functions. | ||||||
@throws | @throws {Type} | function | none | Tag to describe the type of Exceptions that can be raised when the function is called. | ||||||
@type | @type {Type} | variable, inline variable, (function*) | The specified type is used by the build process to determine the correctness of the code that uses the variable and offer Code Completion | Tag to specify the type of the value that a variable can hold. | ||||||
@typedef | @typedef {Type} | variables | ||||||||
@version | @version versionDescription | function, variable | none | Tag to provide information about the version of the code |
...
Use case | Tag | Example |
---|---|---|
function parameters | @param | /** .... } |
function return type | @return | /** |
functions exceptions | @throws | /** |
variables | @type | /** |
|
|
|
...
Expression name | Syntax example | Context | Comments |
---|---|---|---|
Named type | {String} | @param, @return, @type, @throws | The complete list of available types can be seen by triggering Code Completion inside the curly braces in the Script Editor |
Any type | {*} | @param, @return, @type, @throws |
|
OR type | {String|Number} | @param, @return, @type, @throws |
|
REST type | {...String} | @param |
|
Array type | {String[]} {Array<String|Number>} | @param, @return, @type, @throws |
|
Object type | {Object<String>} | @param, @return, @type, @throws |
|
Object type with optional properties | { {name:String, [age]:Number}} | @param, @return, @type, @throws |
|
Function type | {function(String, Number, Array<Object>):Boolean} | @param, @return, @type |
|
JSFoundset type | {JSFoundset<db:/udm/contacts>}1 | @param, @return, @type |
|
JSRecord type | {JSRecord<db:/udm/contacts>}1 | @param, @return, @type |
|
JSDataSet type | {JSDataSet<{name:String, age:Number}>} | @param, @return, @type |
|
RuntimeForm type | {RuntimeForm<superFormName>} | @param, @return, @type |
|
...
Code Block |
---|
/**@type {Array<String>}*/ var myStringArray = \[\] |
If the Object/Array contains entries of different types, the type of the entries cannot be specified when declaring the Object/Array, or only a more generic type can be specified.
An example of a generic type would be RuntimeComponent, which is the super type for RuntimeLabel, RuntimeField etc. RuntimeComponent defines all the properties and methods that all the other RuntimeXxxx types have in common. When the need arises to call methods or set properties that are specific to a specific RuntimeXxx type, the generic type can be casted:
Code Block |
---|
if (elements\[1\] instanceof RuntimeLabel) { /**@type{RuntimeLabel}*/ var myLabel = elements\[1\] var elementNames = myLabel.getLabelForElementName() //Calling method specific for labels } |
...