1

我在函数的 javascript 代码中成功使用了智能感知,但我不知道如何让它为 var 工作,或者我是否应该以不同的方式设计这个类,以便有效地记录它。

(function ($)
{
  $.myNamespace.MyClass = {

    m_varIWantToCommentOn: null,
    /// <summary locid="m_varIWantToCommentOn">
    ///     *This doesn't work here*  How should I comment on what this var is for?
    /// </summary>

    Init: function ()
    {
        /// <summary locid="Init">
        /// Called when MyClass is initialized for the first time.  this comment works fine.
        /// </summary>
        // ...use m_varIWantToCommentOn in some way...
    }
  }
})(jQuery);
4

1 回答 1

1

我知道这个问题有点老了,但万一其他人有同样的问题......

我会使用<field>标签。它超越了它所描述的领域,与内部的功能文档不同。

    (function ($) {
    $.myNamespace.MyClass = {

        /// <field> comments here </field>
        m_varIWantToCommentOn: null,

        Init: function () {
            /// <summary locid="Init">
            /// Called when MyClass is initialized for the first time.  this comment works fine.
            /// </summary>
            // ...use m_varIWantToCommentOn in some way...


        }
    }
})(jQuery);

通常,<var>标签仅在 var 声明中使用,但它们也高于它们所描述的 var。

/// <var>comments here</var>
var someVar = null,
/// <var>This is a number</var>
anotherVar = 0;
于 2012-11-27T22:11:45.237 回答