简体   繁体   English

JSDoc3如何让它知道变量是对Class原型的引用

[英]JSDoc3 how to let it know a variable is a reference to a Class prototype

I've got the following javascript class setup; 我有以下javascript类设置;

/**
 * @class
 * @constructor
 */
var Klass = function() { ... }

var p = Klass.prototype;

/**
 * Set custom options
 * @param {object} options - options
 */
p.setOptions = function(options) {
    ...
}

How do I make JSDoc recognize the 'p' shortcut variable as the Klass. 如何使JSDoc识别“ p”快捷方式变量为Klass。 If I use 'Klass.prototype' instead of 'p' it recognizes the setOptions method perfectly. 如果我使用“ Klass.prototype”而不是“ p”,它将完美识别setOptions方法。

Try adding a method tag, and prepending the classname to it. 尝试添加方法标签,并在其前面添加类名。

/**
 * Set custom options
 * @method Klass.setOptions
 * @param {object} options - options
 */
p.setOptions = function(options) {
   ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM