Documenting a Marionette Module with RequireJS and JSDoc3
I'm finally taking some time to formally document my Marionette code, but I'm running into some issues with JSDoc3 and Marionette modules.
How would I go about documenting a Marionette module defined like this:
//Module1.js
define([... , 'views'], function(..., 'views'){
"usestrict";
//Marionette Module definition:
return function(...marionette module params...){
...
}
}
and then hook it up in the docs to a view defined like this:
//views.js
define([...], function(...){
"usestrict";
var itemView = Marionette.ItemView.extend({
...
};
//Uses itemView in a region
return Marionette.Layout.extend({
...
//do stuff with itemView
...
});
}
?
Thanks!
Ok, thanks to Louis I figured out how to get the module to be recognized. I was then able to mess around with it enough to get the view registered as a class to the module.
Module1.js:
/** @module Module1 */
define([... , 'views'], function(..., 'views'){
"usestrict";
/** @lends module:Module1 */
//Marionette Module definition:
return function(...marionette module params...){
...
}
}
and View.js:
define([...], function(...){
"usestrict";
/**
* @name module:Module1.Module1/Views/itemView
* @constructor
*/
var itemView = Marionette.ItemView.extend(
/** @lends module:Module1.Module1/Views/itemView.prototype */
{
...
};
/**
* @name module:Module1.Module1/Views/layoutView
* @constructor
*/
return Marionette.Layout.extend(
/** @lends module:Module1.Module1/Views/layoutView.prototype */
{
...
//do stuff with itemView
...
});
}
A couple of notes:
上一篇: 骨干AMD与requireJs