I’d like to know how to document this type of class using jsdoc:
var MyObject = (function(){
var that = {};
function privateFunction(){};
that.publicFunction = function(){};
that.publicField = "foo";
return that;
})();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are a number of things named JSDoc, but using closure compiler annotations which work with jsdoc toolkit, you can use
@constructorto markMyClassas a constructor.Then you can make it clear that
thatis of the nominal typeMyClassthough obviously that nominal type won’t work withinstanceof.The first
@typeestablishes the type of the declaration, and the second is a type assertion/cast for the value.With the methods you can use the
@thisannotation.