JSDoc 中文网

概述

¥Overview

当使用对象字面量定义类(例如使用 @lends 标记)时,@constructs 标记允许你记录将使用特定函数来构造该类的实例。

¥When using an object literal to define a class (for example with the @lends tag) the @constructs tag allows you to document that a particular function will be used to construct instances of that class.

语法

¥Syntax

@constructs [<name>]

示例

¥Examples

将 @constructs 标签与 @lends 一起使用
var Person = makeClass(
    /** @lends Person.prototype */
    {
        /** @constructs */
        initialize: function(name) {
            this.name = name;
        },
        /** Describe me. */
        say: function(message) {
            return this.name + " says: " + message;
        }
    }
);
如果没有@lends,你必须提供类的名称
makeClass('Menu',
    /**

     * @constructs Menu

     * @param items
     */
    function (items) { },
    {
        /** @memberof Menu# */
        show: function(){
        }
    }
);