JsDoc:从 属性 中删除 "static" 标签
JsDoc: Remove "static" tag from property
我有用 JavaScript 编写的图形构造函数。文档有点乏味。以下是我的代码和文档的一部分,但无法按我的意愿运行:
function Graph() {
....
var nodes = [];
Object.defineProperties(this, {
/**
* An array of all node handles in the graph
*
* @return {Array}
*/
nodes: {
get: function() {
var ids = [];
for (var id in nodes) {
ids.push(id);
}
return ids;
}
}
});
....
}
基本上,我想要做的是确保不能使用其他方式操作图形,除了通过提供节点列表副本而不是实际节点列表提供的方法。
这很好用,但在 JsDoc 中,它被定义为静态的:
<static> Graph.nodes
An array of all node handles in the graph
现在,这个 属性 不是静态的。它对于图形的所有实例都是独立的。我的猜测是 JsDoc 将 nodes
属性 的定义识别为在 Object.defineProperties()
内部,并声称这里的所有声明都是静态的。
有没有办法告诉 JsDoc 这个 属性 实际上不是静态的?我只能找到标签 @static
,它的作用恰恰相反。
有@instance,见documentation
// 编辑:工作示例
/**
* @constructor
*/
function Graph() {
var nodes = [];
Object.defineProperties(this, {
/**
* An array of all node handles in the graph
* @return {Array}
* @memberof Graph
* @instance
*/
nodes: {
get: function() {
var ids = [];
for (var id in nodes) {
ids.push(id);
}
return ids;
}
}
});
}
我有用 JavaScript 编写的图形构造函数。文档有点乏味。以下是我的代码和文档的一部分,但无法按我的意愿运行:
function Graph() {
....
var nodes = [];
Object.defineProperties(this, {
/**
* An array of all node handles in the graph
*
* @return {Array}
*/
nodes: {
get: function() {
var ids = [];
for (var id in nodes) {
ids.push(id);
}
return ids;
}
}
});
....
}
基本上,我想要做的是确保不能使用其他方式操作图形,除了通过提供节点列表副本而不是实际节点列表提供的方法。
这很好用,但在 JsDoc 中,它被定义为静态的:
<static> Graph.nodes
An array of all node handles in the graph
现在,这个 属性 不是静态的。它对于图形的所有实例都是独立的。我的猜测是 JsDoc 将 nodes
属性 的定义识别为在 Object.defineProperties()
内部,并声称这里的所有声明都是静态的。
有没有办法告诉 JsDoc 这个 属性 实际上不是静态的?我只能找到标签 @static
,它的作用恰恰相反。
有@instance,见documentation
// 编辑:工作示例
/**
* @constructor
*/
function Graph() {
var nodes = [];
Object.defineProperties(this, {
/**
* An array of all node handles in the graph
* @return {Array}
* @memberof Graph
* @instance
*/
nodes: {
get: function() {
var ids = [];
for (var id in nodes) {
ids.push(id);
}
return ids;
}
}
});
}