code-documentation

JSDoc: Return object structure

删除回忆录丶 提交于 2019-11-29 18:58:32
How can I tell JSDoc about the structure of an object that is returned. I have found the @return {{field1: type, field2: type, ...}} description syntax and tried it: /** * Returns a coordinate from a given mouse or touch event * @param {TouchEvent|MouseEvent|jQuery.Event} e * A valid mouse or touch event or a jQuery event wrapping such an * event. * @param {string} [type="page"] * A string representing the type of location that should be * returned. Can be either "page", "client" or "screen". * @return {{x: Number, y: Number}} * The location of the event */ var getEventLocation = function(e,

What do the three arrow (“>>>”) signs mean?

岁酱吖の 提交于 2019-11-29 10:49:06
问题 So this is probably a dumb question, but I have now been searching for quite some time, and I haven't been able to figure out what they do even though I see them often in source-codes. 回答1: You won't see it in source code, it's probably documentation. It indicates an interactive session, and things typed into the 'interpreter' are marked with this. Output is shown without the arrows. In fact, the python documentation often has a button >>> at the top right of example code to be able to hide

codestyle; put javadoc before or after annotation?

五迷三道 提交于 2019-11-28 04:26:09
I know that it isn't the most vital of issues, but I just realised that I can put the javadoc comment block before or after the annotation. What would we want to adopt as a coding standard? /** * This is a javadoc comment before the annotation */ @Component public class MyClass { @Autowired /** * This is a javadoc comment after the annotation */ private MyOtherClass other; } Peter Jaric Before the annotation, since the annotation is code that "belongs" to the class. See examples with javadoc in the official documentation. Here's random example I found in another official Java page : /** *

What is the availability of NSNotFound?

不想你离开。 提交于 2019-11-28 03:37:37
问题 This in-Xcode documentation for NSNotFound is quite confusing: It says "Available in iOS 2.0 through 8.4" and "Availability: iOS 8.1 to 8.0". So... Is it available before 8.0? Or in 9.0+? Also, what's going on here, if it is? 回答1: Insert availabilityOfNSNotFound == NSNotFound joke here. At some point when Apple was pushing mandatory 64-bit device support (iOS 8.4 SDK?), the declaration of NSNotFound was changed from: enum {NSNotFound = NSIntegerMax}; to static const NSInteger NSNotFound =

How to document a string type in jsdoc with limited possible values

流过昼夜 提交于 2019-11-27 18:55:29
I am having a function that accepts one string parameter. This parameter can have only one of a few defined possible values. What is the best way to document the same? Should shapeType be defined as enum or TypeDef or something else? Shape.prototype.create = function (shapeType) { // shapeType can be "rect", "circle" or "ellipse"... this.type = shapeType; }; Shape.prototype.getType = function (shapeType) { // shapeType can be "rect", "circle" or "ellipse"... return this.type; }; The second part of the problem is that the possible values of shapeType is not known in the file that defines

codestyle; put javadoc before or after annotation?

一笑奈何 提交于 2019-11-27 05:23:19
问题 I know that it isn't the most vital of issues, but I just realised that I can put the javadoc comment block before or after the annotation. What would we want to adopt as a coding standard? /** * This is a javadoc comment before the annotation */ @Component public class MyClass { @Autowired /** * This is a javadoc comment after the annotation */ private MyOtherClass other; } 回答1: Before the annotation, since the annotation is code that "belongs" to the class. See examples with javadoc in the

How to document a string type in jsdoc with limited possible values

不羁岁月 提交于 2019-11-27 04:18:22
问题 I am having a function that accepts one string parameter. This parameter can have only one of a few defined possible values. What is the best way to document the same? Should shapeType be defined as enum or TypeDef or something else? Shape.prototype.create = function (shapeType) { // shapeType can be "rect", "circle" or "ellipse"... this.type = shapeType; }; Shape.prototype.getType = function (shapeType) { // shapeType can be "rect", "circle" or "ellipse"... return this.type; }; The second