modules.js

An XHR JavaScript module loader.

MIT License
© 2004-2007 Kris Kowal

Small

Source 61 KB
Packed 21 KB
Gziped 6 KB

Portable

Firefox
Safari
Explorer

Powerful

Loads Scripts
Isolates Namespaces
Manages Dependencies

Get

Learn

Participate

Loading

Loading modules.js and your site's index.js modules.

<script src="modules.js?
./index.js">
</script>

Importing

Importing names from another module.

include(
  'theModule.js'
);

Requiring

Getting a module object.

var theModule =
require(
  'theModule.js'
);

Declaring

Declaring an exported item.

this.exportMe = 1;

Hiding

Declaring an item that will not be visible outside your module.

var hideMe = 1;