Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Global exported functions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tim Statler  
View profile  
 More options Mar 29 2012, 8:11 pm
From: Tim Statler <tim.stat...@gmail.com>
Date: Thu, 29 Mar 2012 17:11:22 -0700
Local: Thurs, Mar 29 2012 8:11 pm
Subject: Global exported functions
Hi,

I need to document several functions defined in a single JS file. Each
has the following pattern:

// functions.js
/**
*    A function
*/
var a = exports.someFunction = function() {
    return "foo";

};

/**
*    Another function
*/
var b = exports.someOtherFunction = function(){
    return "bar";

};

These are coded as modules, but they will be consumed as global
functions, not as required modules. I looked at the JSDoc3 modules
pattern page for inspiration
(http://usejsdoc.org/howto-commonjs-modules.html). The patterns there
generated prototypes in the output, which I don't want in this case.
Rather, I want to list each function under the global namespace.

This seems pretty basic so I'm probably missing something obvious.
Thanks for any help.

Tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Mathews  
View profile  
 More options Mar 30 2012, 3:24 am
From: Michael Mathews <micm...@gmail.com>
Date: Fri, 30 Mar 2012 08:24:49 +0100
Local: Fri, Mar 30 2012 3:24 am
Subject: Re: Global exported functions
Anytime you find yourself battling to get the documentation to say something that your code doesn't, as in a method of exports that is really a global function, you should switch yourself into a mode where you just plan to provide a @name for all your doclets. You might find you can get away without a @name once in a while and that would be a bonus, but don't waste so much effort trying to avoid just writing what you want in your output.

// functions.js

/**
*    @function someFunction
*    @returns {string} foo
*/
var a = exports.someFunction = function() {
   return "foo";

};

/**
*    @function someOtherFunction
*    @returns {string} bar
*/
var b = exports.someOtherFunction = function(){
   return "bar";

};

Note that in JSDoc 3 you can either use a separate @name tag or put the @name after a tag that identifiers the @kind of thing you are documenting, so @function foo, @class foo, @method foo.qaz, @member foo.blat etc.

Michael Mathews
micm...@gmail.com

On 30 Mar 2012, at 01:11, Tim Statler wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »