abzfarah / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

NamespaceOf #249

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Given a complex namespace, where "sub-namespaces" are nested, I can find no
way to have the sub-namespaces display their contents separately, as well
as listing the sub-namespace within its parent namespace.

/**
 * @namespace
 */
var foo = {
    /**
     * @namespace
     */
    bar: {
        a: "something",
        b: "something"
    },
    /**
     * @namespace
     */
    baz: {
        a: "something",
        b: "something"
    }
}

Is there some way to get this to work?  Otherwise, it'd be really nice to
have a @namespaceOf, similar to @methodOf, etc, to be able to force assign
namespaces to their parents.  (Esp useful when a single complex namespace
is being defined from many different source files.)

Original issue reported on code.google.com by brian.br...@gmail.com on 8 Sep 2009 at 6:33

GoogleCodeExporter commented 8 years ago
Would this work?

/**
 * @namespace
 */
var foo = {
    /**
     * @namespace
     * @memberOf foo
     */
    bar: {
        a: "something",
        b: "something"
    },
    /**
     * @namespace
     * @memberOf foo
     */
    baz: {
        a: "something",
        b: "something"
    }
}

Original comment by micmath on 8 Nov 2009 at 8:30

GoogleCodeExporter commented 8 years ago
It doesn't now, but yes, that'd be the right idea.  (Or NamespaceOf could also 
be a
shortcut to namespace+memberOf, ala methodOf).

Original comment by brian.br...@gmail.com on 9 Nov 2009 at 10:10

GoogleCodeExporter commented 8 years ago
/**
 * @namespace
 */
var foo = {
    /**
     * @namespace
     * @memberOf foo
     * @description some explanation of the sub-class
     */
    bar: {
        a: "something",
        b: "something"
    }
}

Works with current build. Issue can be closed

Original comment by abyss...@gmail.com on 3 Jul 2010 at 2:50

GoogleCodeExporter commented 8 years ago

Original comment by micmath on 3 Jul 2010 at 7:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I don't believe this issue is fixed. At least for my implementation. Here is 
what I have:

-- in Top.js
/** @namespace */
Top = {
//some props and methods here
};

-- in Top/Sub.js
/**
  @namespace
  @memberOf Top
*/
Top.Sub = {
//some props and methods here
};

-- in Top/Sub/MyClass.js
Top.Sub.MyClass = constructor(
/** @lends Top.Sub.MyClass.prototype */
{
  /**
    @constructs
    @property blah
    @property blahblah
  */
  initialize: function() {//do some stuff to this},

  /** @methodOf Top.Sub.MyClass.prototype */
  someMethod: function() {//do some method stuff}
}

So, here's what I get from this code. Classes listed for Top, Top.Sub and 
Top.Sub.MyClass but none of them are connected. I expected to get a reference 
to Top.Sub from Top and to Top.Sub.MyClass from Top.Sub... Besides that 
everything in the namespaces and class is documented as expected.

I am using jsdoc_toolkit-2.4.0

Original comment by seanmcke...@gmail.com on 19 Aug 2010 at 7:18