Questions tagged «code-documentation»


3
JSDoc:返回对象结构
如何将返回的对象的结构告诉JSDoc。我找到了@return {{field1: type, field2: type, ...}} description语法并尝试了它: /** * 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 …

5
如何用有限的可能值在jsdoc中记录字符串类型
我有一个接受一个字符串参数的函数。此参数只能具有几个定义的可能值之一。记录相同内容的最佳方法是什么?应该将shapeType定义为enum还是TypeDef或其他? 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; }; 问题的第二部分是,在shapeType定义shapeType为您所建议的内容的文件中,未知的可能值。有几个开发人员提供的多个文件可能会增加的可能值shapeType。 PS:正在使用 jsdoc3

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.