I'm currently refactoring some Javascript code we have and amongst other things I've changed it to make use of the revealing module pattern. The code is looking much tidier and it works fine but I can't see the functions anymore in the outline view. I see the top level namespace var as a var but you can't expand it to see the functions within.
Lets say the code used to look like this:
function myFunc1() {}
function myFunc2() {}
In this case you see both functions in the outline view. But if you change it to this:
var myNamespace = function()
{
function myFunc1() {}
function myFunc2() {}
return {
name: "myNamespace",
myFunc1: myFunc1,
myFunc2: myFunc2
}
}();
Then the outline view just shows you the myNamespace var. I've tried looking but can't find a view that will actually show me the hierarchy correctly. Does anyone know of a way to view this or is it a case of eclipse not being able to do this?
Add:
/**
* @memberOf myNamespace
*/
before each function definition to restore the hierarchy.
You will find more interesting tags to document your code here:
How I Introduced JsDoc into a JavaScript project – and found my Eclipse Outline
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With