I am at the starting point of trying to build a JavaScript library for our RIA application at work. Currently we have lots of JavaScript files with functions all in global scope and I would like to attempt to put some reasonable namespace and context to our functions. Possibly putting them into object form.
I've been looking at other open source libraries to help me understand the best way to build a library. I see a lot of .js files with the following in one particular open-source project.
/**
* @required OpenLayers/Map.js
*/
for example.
Does this have any meaning other than just being a comment in the file? Is there some kind of way to import other .js files into your main build with this annotation or an import statement like in Java?
This code is using JsDoc (http://jsdoc.sourceforge.net/) or something similar to create documentation from the source code, most likely.
Javascript doesn't actually have annotations.
Choose RequireJS. It is a JavaScript file and module loader. It implements the CommonJS proposal.
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