Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSDOC: Is it possible to link to a module property?

I'd like know if it's possible to link from one module to another module`s property/method.

What I've tried so far but wasn't working:

/**
 * {@link module:modules/modulName#id}
 */

My modules follow this pattern:

/**
 * @module modules/modulName
 */
define(function() {

    'use strict';

    /**
     * @alias module:modules/modulName
     */
    var module = {
        /** Initialisation */
        init: function() {}
    };

    return module;

});

Is there a way to achieve what I want?

like image 370
damian Avatar asked Oct 30 '22 20:10

damian


1 Answers

Ok so from what I managed to do on my own

/**
 * @module namespace/moduleName
 */

/**
 * @name module:namespace/moduleName#propName
 * @type {Object}
 */
const propName= {}

Then in another file you can reference with:

/*
 * @see module:namespace/moduleName#propName
 */

You can use @link or even @type if you have @typedef with that name.

Tested this with PHPStorm and it works as it should. No idea for auto generated API's with JSDOC.

like image 145
Dobromir Hristov Avatar answered Nov 08 '22 04:11

Dobromir Hristov