Closed Bug 640055 Opened 15 years ago Closed 15 years ago

Move all files to the "var %modulename% = exports" method of exporting

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gmealer, Unassigned)

References

Details

(Whiteboard: [module-refactor])

Attachments

(1 file)

Henrik has taken to doing something cool in his submissions. After defining the doc namespace with @name, he then creates an alias to the common.js exports object with the desired name of the namespace. I like this method because it clearly establishes--within the file itself--how we'd like other files to import it. Ex: /** * @namespace Defines wrapper methods for back-end services */ var services = exports; Note to Henrik: we don't need @name services anymore. It'll use the name of the var as it should. We only needed @name when there was no actual variable.
Makes it even simpler then. :)
Summary: Move all files to the var [modulename] = exports method of exporting → Move all files to the "var %modulename% = exports" method of exporting
https://github.com/geoelectric/mozmill-api-refactor/tree/ms1-exports Note that I didn't add namespace jsdocs for files that didn't have it already. We still need to figure out the best way to document the map, so I'm intentionally holding off.
Attachment #519540 - Flags: review?(hskupin)
Comment on attachment 519540 [details] [diff] [review] Added module namespace aliases for exports and removed unnecessary @names from namespaces >+var dom = exports; As talked on IRC please add a jsdoc comment for the dom module. >+var navBar = exports; Question here is should we use camelCase or simply have an 1:1 naming schema with the file name: session.js -> var session = exports; navbar.js -> var navbar = exports; The latter option would make it more clear that we put objects onto the module scope. Otherwise looks fine. r=me with the first part updated.
Attachment #519540 - Flags: review?(hskupin) → review+
Will do on the dom comment. Re: camelCasing, I originally had it as "navbar" and "tabbar," but checked the current project and we'd camel-cased domUtils and similar. So I changed it. I could go either way, though I think there are some compound words (like tabbar) where it's a bit ugly. I thought about the exact same thing re: matching filename to identifier, and agree that'd be the reason, if any.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: