Modules/GlobalObjectLoading

From CommonJS Spec Wiki
Jump to: navigation, search

STATUS: PROPOSAL, NO LONGER BEING PURSUED, SEE Modules

A system similar to the simple file loading as file content is still evaluated in the global scope; however, this system depends on a naming convention between file and object names. This makes it a bit more Java-like and is more heavily dependent on the library path. It removes the need to think about a file system and makes it possible to use the same system in the browser.

 
// 
// Searching through the library path.  
// Suppose the path is 
// /home/peter/js:/usr/local/lib/js:/usr/lib/js 
// Then if can evaluate the content of the file 
// /usr/local/lib/js/io/File.js in the global scope 
// with
load('io.File')  
 
// 
// Use 'load' above only if this file has never been 
// loaded before. 
// 
load.once('io.File')
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox