2016-08-02 1 views
1

예를 들어 emberJS 컨트롤러가 있습니다. YUIDoc을 사용하여 문서를 생성하려면 올바르게 주석을 달려면 어떻게해야합니까?YUIDoc, 주석 스타일을 사용하는 EmberJS 설명서?

import Ember from 'ember'; 

/** 
* ? 
*/ 
export default Ember.Controller.extend({ 
    queryParams: ['param1', 'param2'], 

    /** 
    * ? 
    */ 
    param1: '', 

    /** 
    * ? 
    */ 
    param2: 10, 

    /** 
    * 
    */ 
    testFunc1(param) { 

    }, 

    /** 
    * 
    */ 
    actions: { 
    /** 
    * ? 
    */ 
    testFunc2(id) { 

    }, 

    /** 
    * ? 
    */ 
    testFunc3() { 
     /** 
     * ? 
     */ 
     function testFunc4() { 
     } 

    } 

    } 
}); 

나는 emberJS 코드 문서에 대한 모범 사례를 알고 싶으므로 결국에는 완전한 계층 구조로 올바른 문서를 얻을 수 있습니다. 어떤 도움을 주시면 감사하겠습니다.

답변

0

이렇게 대답이 하나 있습니다. 누군가가 더 나은 해결책을 가지고 있다면 공유하십시오.

import Ember from 'ember'; 

/** 
* The login controller shows the login form and sends authentication data to the session. 
* 
* @class login 
* @namespace Controller 
*/ 
export default Ember.Controller.extend({ 

    /** 
    * The session service. 
    * 
    * @property session 
    * @readOnly 
    * @type Service 
    */ 
    session: Ember.inject.service('session'), 

    /** 
    * The identification, usually an username or e-mailaddress. 
    * 
    * @property identification 
    * @type String 
    * @default null 
    */ 
    identification: '', 

    /** 
    * The password. 
    * 
    * @property password 
    * @type String 
    * @default null 
    */ 
    password: '', 


    actions: { 

    /** 
    * The authenticate action sends the identification and password to the session. 
    * 
    * @event authenticate 
    * @return undefined 
    */ 
    authenticate() { 
     this.get('session').authenticate('authenticator:jwt', this.getProperties('identification', 'password')); 
    } 

    } 

}); 
+0

나는 액션과 액션 클로저에'@ method'를 사용하는 경향이 있습니다. 필자는 자신의 구성 요소/컨트롤러 템플릿이나 내부 사용을'@ private'로하는 모든 속성이나 메서드에 태그를 붙이는 경향이 있습니다. 속성과 액션 클로저는 응용 프로그램이'@ public'으로 작동 할 것으로 기대합니다. – Sukima

0

다음은 컨트롤러에서도 사용할 수있는 구성 요소에 사용하는 예입니다.

/** 
* @module Components 
*/ 
import Ember from 'ember'; 
import MyMixin from '../mixins/my-mixin'; 
const { Component, inject, computed } = Ember; 

/** 
* My aweseome component 
* 
* ## Example Ussage: 
* ```handlebars 
* {{awesome-thing 
*  foo="bar" 
*  baz=boundProp 
*  doit=(action "myAction")}} 
* ``` 
* 
* @class AwesomeThingComponent 
* @extends Ember.Component 
* @uses Mixins.MyMixin 
*/ 
export default Component.extend(MyMixin, { 
    /** 
    * @property {Services.MyService} myService 
    * @private 
    */ 
    myService: inject.service(), 

    /** 
    * Set this to "bar". 
    * @property {String} foo 
    * @default foobar 
    * @public 
    */ 
    foo: 'foobar', 

    /** 
    * Bind this property (Data Down). 
    * @property {Boolean} baz 
    * @public 
    */ 

    /** 
    * Private function 
    * @method myFunc 
    * @private 
    */ 
    myFunc() { 
    // Code 
    }, 

    actions: { 
    /** 
    * This is my closure action 
    * @method actions.doit 
    * @param {Object} payload the payload that will be sent to the action 
    * @return {Promise} any expectation that the action closure will return 
    * a value 
    * @required 
    * @public 
    */ 

    /** 
    * Internal action that will call `doit`. 
    * @method actions.myAction 
    * @private 
    */ 
    myAction() { 
     get(this, 'doit')({payload: 1}).then(() => { 
     console.log('yeah!'); 
     }); 
    } 
    } 
});