D
D
Delias2014-10-04 17:56:38
JavaScript
Delias, 2014-10-04 17:56:38

Why doesn't Jsdoc work with closures?

I'm trying to deal with jsdoc - the thing seems to be interesting, but for some reason it does not document the code in the closure.
Those. there is a file:

(function() {

    'use strict';

    /**
     * Represents a book.
     * @constructor
     * @param {string} title - The title of the book.
     * @param {string} author - The author of the book.
     */
    function Book(title, author) {}

})();

And this file is not documented in any way, an empty document is generated.
If the closure is removed, then the documentation works - a page with a description of the fields is generated.
Why is that? I have all the code in closures - shouldn't it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Petrov, 2014-10-04
@Petroveg

And have you tried this as well ?
It is suggested to use @name, @namespace , @lends

/**
 * @name MyNamespace
 * @namespace Hold all functionality
*/
(function () {
  /** @lends MyNamespace
   * Описание
  */
  ...
}());

I've got another solution .
It is suggested to use @module , @lends
/**
 * @module constructors
*/
var app = (/** @lends module:constructors */ function() {
  /**
   * Описание
  */
  ...
}());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question