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(){
        }
    }
);