I'm working on fairly heavy client JavaScript application and was looking to add documentation. I went with vsdoc style so as to get picked up by intellisense, but am having trouble defining return objects.
Assuming a function defined as:
function returnObject() {
return { 'prop1': 'value1', method: function(){return 1;}};
}
I'd like to be able to write code as:
returnObject(). and after the . see 'prop1' and 'method' in the intellisense - is this possible without defining an object elsewhere?
How would I define the return object? I've been looking at documentation here, but so far it's been of little help. Looking at the jQuery vsdoc shows me that they almost always return the jQuery object or a simple type. Looking at amplify vsdoc shows that they return Object or undefined and then explain what that object looks like in text.
Can I use the /// element style documentation to define what the return object will look like? Does anyone have any sample of this?
You don't need a vsdoc file for this scenario in visual studio 2012+.
The vsdoc is useful for situations where the internal javascript interpreter can't execute the code, for example web services.
vsdoc files are also useful for when jsdoc style comments are used in the code, and you don't want to have 2 comment formats in the main code files. Jquery is a good example of this.
Also note that vsdoc files are now referred to as intellisense files. However the concept is still the same.
Using inline comments: