Using the @instance tag will mark a symbol as an instance member of its parent symbol. This means it can be referred to by "Parent#Child".
Using @instance will override a doclet's default scope (unless it is in the global scope, in which case it will remain global).
The following example is a longhand way of writing "@function MyNamespace#myFunction":
/** @namespace MyNamespace */ /** * myFunction is now MyNamespace#myFunction. * @function myFunction * @memberof MyNamespace * @instance */
More usefully, you can use the @instance tag to override the scope that JSDoc infers. For example, you can indicate that a static member is used as an instance member:
/** @namespace */
var BaseObject = {
/**
* foo is now BaseObject#foo rather than BaseObject.foo.
* @instance
*/
foo: null
};
/** Generates BaseObject instances. */
function fooFactory(fooValue) {
var props = { foo: fooValue };
return Object.create(BaseObject, props);
}
© 2011–2017 the contributors to the JSDoc 3 documentation project
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://usejsdoc.org/tags-instance.html