I
I
Ilusha2015-02-03 18:34:45
JavaScript
Ilusha, 2015-02-03 18:34:45

What is the correct way to write jsdoc (require.js + backbone)?

Hello.
I will go straight to the question, bypassing the water.
There is a set of modules/classes of the following form:
Parent

define([
  "backbone", "lodash", "jquery"
], function (
  Backbone, _, $
){
  return Backbone.View.extend({...})
}

Child
define([
  "parentClass"
], function (
  parentClass
){
  return parentClass.extend({...})
}

Question: how to write jsDoc for such constructions in order to take into account all dependencies?
(Ideally, make sure that the IDE (idea/phpStorm) understands that a property/method of the parent class is being used, and in dreams - build a dependency graph to see what depends on a particular method, but these will be other questions).
PS: I tried many solutions, but nothing sensible happened, I will not describe them here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Rodkin, 2015-02-04
@Ilusha

I would do this:
Parent

define([
    'backbone',
    'lodash',
    'jquery',
], function (
    Backbone,
    _,
    $
) {

    /**
     * @classdesc Best Parent class ever
     * @class
     */
    var Parent = Backbone.View.extend({
        ...
    });

    return Parent;

});

Child
define([
    'Parent',
], function (
    Parent
) {

    /**
     * @classdesc Little children
     * @class
     * @augments Parent
     */
    var Child = Parent.extend({
        ...
    });

    return Child;

});

But there is a feeling that AMD Modules are better suited here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question