加载中...

@constructs


描述: 这个函数成员将成为类的构造函数。

Overview(概述)

当使用对象字面量形式定义类(例如使用@lends标签)时,可使用@constructs标签标明这个函数用来作为类的构造实例。

Syntax(语法)

@constructs [<name>]

Examples(例子)

例如, @constructs 和 @lends 结合使用:

  1. var Person = makeClass(
  2. /** @lends Person.prototype */
  3. {
  4. /** @constructs */
  5. initialize: function(name) {
  6. this.name = name;
  7. },
  8. /** Describe me. */
  9. say: function(message) {
  10. return this.name + " says: " + message;
  11. }
  12. }
  13. );

不和@lends结合使用的时候,你必须提供一个类的名称:

  1. makeClass('Menu',
  2. /**
  3. * @constructs Menu
  4. * @param items
  5. */
  6. function (items) { },
  7. {
  8. /** @memberof Menu# */
  9. show: function(){
  10. }
  11. }
  12. );

还没有评论.