Modules

  • Revision slug: CommonJS/Modules
  • Revision title: Modules
  • Revision id: 93357
  • Created:
  • Creator: dangoor
  • Is current revision? No
  • Comment page created, 135 words added

Revision Content

To date, client side JavaScript has generally been able to get away with something as simple as the <script> tag and no standard way to do namespaces. On the server, it's a bit different because you're more likely to use more libraries and you can potentially load up a lot of code. Having a basic system for loading code and ensuring that the code you load does not interfere with other code will underlie everything else.

Prior Art

  • Spidermonkey offers a load function, but does not have any specific pattern for namespacing.
  • Dojo has a complete incremental loading facility in the form of dojo.require and a standard mechanism for declaring modules. dojo.require ensures that the module is loaded only once.

Proposed API

TBD

Related discussions

 

Revision Source

<p>To date, client side JavaScript has generally been able to get away with something as simple as the &lt;script&gt; tag and no standard way to do namespaces. On the server, it's a bit different because you're more likely to use more libraries and you can potentially load up a lot of code. Having a basic system for loading code and ensuring that the code you load does not interfere with other code will underlie everything else.</p>
<h3>Prior Art</h3>
<ul> <li>Spidermonkey offers a <a class="external" href="en/Introduction_to_the_JavaScript_shell" title="https://developer.mozilla.org/editor/fckeditor/core/editor/en/Introduction_to_the_JavaScript_shell">load</a> function, but does not have any specific pattern for namespacing.</li> <li>Dojo has a complete incremental loading facility in the form of <a class="external" href="http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/functions-used-everywhere/dojo-require" title="http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/functions-used-everywhere/dojo-require">dojo.require</a> and a standard mechanism for declaring modules. dojo.require ensures that the module is loaded only once.</li>
</ul>
<h3>Proposed API</h3>
<p>TBD</p>
<h3>Related discussions</h3>
<ul> <li><a class="external" href="http://groups.google.com/group/serverjs/browse_thread/thread/d761996c25769e6c" title="http://groups.google.com/group/serverjs/browse_thread/thread/d761996c25769e6c">"a module system (difficult to agree)"<br> </a> </li>
</ul>
<p> </p>
Revert to this revision