Using namepaths with JSDoc
Namepaths in JSDoc
The example below shows: an instance method named "say," an inner function also named "say," and a static method also named "say." These are three distinct methods that all exist independently of one another.
You would use three different namepath syntaxes to refer to the three different methods:
You might wonder why there is a syntax to refer to an inner method when that method isn't directly accessible from outside the function it is defined in. While that is true, and thus the "~" syntax is rarely used, it is possible to return a reference to an inner method from another method inside that container, so it is possible that some object elsewhere in your code might borrow an inner method.
Note that if a constructor has an instance member that is also a constructor, you can simply chain the namepaths together to form a longer namepath:
In this case, to refer to the method named "consider," you would use the following namepath:
This chaining can be used with any combination of the connecting symbols:
# . ~
There are some special cases with namepaths: @module names are prefixed by "module:", @external names are prefixed by "external:", and @event names are prefixed by "event:".
Above is an example of a namespace with "unusual" characters in its member names (the hash character, dashes, even quotes). To refer to these you just need quote the names: chat."#channel", chat."#channel"."op:announce-motd", and so on. Internal quotes in names should be escaped with backslashes: chat."#channel"."say-"hello"".