2010-05-05 7 views
3

나는 다음과 같은 무 클래스가 있습니다Mootools의 클래스와 JsDoc


Nem.Ui.Window = new Class({ 
    Implements: [Options, Events], 

    options: { 
     caption: "Ventana", 
     icon:  $empty, 
     centered: true, 
     id:   $empty, 
     width:  $empty, 
     height:  $empty, 
     modal:  false, 
     desktop: $empty, 
     x:   $empty, 
     y:   $empty, 
     layout:  $empty 
    }, 

    initialize: function(options) 
    { 
     this.setOptions(options); 
     /* ... */ 
    }, 

    setHtmlContents: function(content) 
    { 
     /* ... */ 
    }, 

    setText: function(text) 
    { 
     /* ... */ 
    }, 

    close: function(win) 
    { 
     /* ... */ 
    }, 

    /* ... */ 
}); 

내가 JsDoc으로 내용을 문서화 할을. 나는 new Class 안에 @lends [class].prototype을 사용할 수 있으며 initialize에는 @constructs 태그를 붙일 수 있다고 읽었습니다. 방법과 이벤트를 어떻게 표시 할 수 있습니까?

I.E .: setHtmlContents이 방법이어야합니다. close은 이벤트 여야합니다.

또한아래의 요소를 문서화 할 수 있습니까?

답변

5

당신은 @event@function와 방법과 이벤트를 표시 할 수 있습니다,하지만 기능은 기본적으로 제대로 감지되기 ​​때문에 @function 태그는 귀하의 경우이 켜지지되지 않습니다.

options 아래의 요소는 으로 예에서 @memberOf으로 문서화 할 수 있습니다. 그러면 생성 된 JSDoc에 options.optionName으로 표시됩니다.

내가 initialize에서 @constructs을 생략 한 것을

/** @class This class represents a closabe UI window with changeable content. */ 
Nem.Ui.Window = new Class(
/** @lends Nem.Ui.Window# */ 
{ 
    Implements: [Options, Events], 

    /** The options that can be set. */ 
    options: { 
     /** 
     * Some description for caption. 
     * @memberOf Nem.Ui.Window# 
     * @type String 
     */ 
     caption: "Ventana", 
     /** 
     * ... 
     */ 
     icon:  $empty, 
     centered: true, 
     id:   $empty, 
     width:  $empty, 
     height:  $empty, 
     modal:  false, 
     desktop: $empty, 
     x:   $empty, 
     y:   $empty, 
     layout:  $empty 
    }, 

    /** 
    * The constructor. Will be called automatically when a new instance of this class is created. 
    * 
    * @param {Object} options The options to set. 
    */ 
    initialize: function(options) 
    { 
     this.setOptions(options); 
     /* ... */ 
    }, 

    /** 
    * Sets the HTML content of the window. 
    * 
    * @param {String} content The content to set. 
    */ 
    setHtmlContents: function(content) 
    { 
     /* ... */ 
    }, 

    /** 
    * Sets the inner text of the window. 
    * 
    * @param {String} text The text to set. 
    */ 
    setText: function(text) 
    { 
     /* ... */ 
    }, 

    /** 
    * Fired when the window is closed. 
    * 
    * @event 
    * @param {Object} win The closed window. 
    */ 
    close: function(win) 
    { 
     /* ... */ 
    }, 

    /* ... */ 

}); 

처럼이 문서에 표시되지 않습니다 때문에 클래스의 완전히 문서화 된 버전은 모두 다음 것 내가 알아 냈하지 않은 이것이 제대로 작동하도록하는 방법.

사용 가능한 태그 및 해당 기능에 대한 자세한 내용은 jsdoc-toolkit의 wiki에있는 TagReference을 참조하십시오.

0

마지막으로 Natural Docs를 사용하여이 문제를 해결했습니다.

+1

감사합니다. 고맙습니다. 감사합니다. – awm

+0

이것은 원래의 질문에 대한 답이 아닙니다. 그것은 가장 좋은 해결 방법입니다. – Bart

+0

자유롭게 대답 해주세요 :) –