2014-09-14 8 views
0

어떻게 JSDOC에서 함수 인수 가능한 구성 특성을 문서화 :JSDOC의 함수 인수에 가능한 구성 등록 정보를 문서화하는 방법은 무엇입니까?

/** 
* N level expectimax AI. 
* 
* @param {object} cfg config 
* cfg.minimaxDepth - limit for minimax search 
* cfg.expectiDepth - limit for expectimax search 
* cfg.weightFn - position weight function 
* 
* @constructor 
*/ 
function expectimaxAI(brdEngine, cfg) { ... } 

마크 업을 cfg.minimaxDepth (cfg.*) 매개 변수에 사용할 수 있나요? 어떻게 든 다른

* @param {aiCfg} cfg config 

나 :

는 합성 aiCfg 유형을 문서화하고 그것을 참조를 넣을 수 있습니까? official JSDoc 2.x docs을 읽은 후

답변

0

나는 몇 가지 해킹합니다

/** 
* @name BlindWeightRandomCfg 
* @function 
* @param {number} left weight 
* @param {number} right weight 
* @param {number} up  weight 
* @param {number} down weight 
*/ 

과 같은 존재하지 않는 기능을 참조하십시오

/** 
* Blind weight random AI. 
* 
* @param {Board} brdEngine board engine from board.js 
* @param {BlindWeightRandomCfg} cfg configuration settings 
* @constructor 
*/ 
ai.BlindWeightRandom = function(brdEngine, cfg) { ... } 

이제 인수 cfg-BlindWeightRandomCfg의 정의에 클릭!

UPDATE JSDoc 2.x를위한 또 다른 가능성은 :

/** 
* @name BlindWeightRandomCfg 
* @namespace 
* @property {number} left weight 
* @property {number} right weight 
* @property {number} up  weight 
* @property {number} down weight 
*/ 

및 JSDoc 3.x에 대한

:

/** 
    @typedef PropertiesHash 
    @type {object} 
    @property {string} id - an ID. 
    @property {string} name - your name. 
    @property {number} age - your age. 
*/ 

/** @type {PropertiesHash} */ 
var props; 

@typedef는이 솔루션 인 것으로 보인다. see other variantsat official docs을 입력하십시오.