要在JSDoc中編寫文件,基本上很類似於JavaDoc的編寫方式,文件是以/**與*/的區塊包括,當中包括一些文件標籤,如果您編寫過JavaDoc,對這些標籤名稱應不陌生:
您可以參考test.js中的例子,以了解每個標籤實際產生的說明位置,例如: /**
* @fileoverview This file is an example of how JSDoc can be used to document * JavaScript. * * @author Ryan Asleson * @version 1.0 */ JSDoc可以為這段文件說明產生以下的內容: ![]() 例如: /**
* Construct a new Person class. * @class This class represents an instance of a Person. * @constructor * @param {String} name The name of the Person. * @return A new instance of a Person. */ function Person(name) { /** * The Person's name * @type String */ this.name = name; … } JSDoc可以為這段文件產生以下的內容: ![]() |