diff --git a/doc/api.html b/doc/api.html index 6ac33796ecb..c9c0a45ef3c 100644 --- a/doc/api.html +++ b/doc/api.html @@ -472,6 +472,7 @@ one-to-one correspondence. As an example, foo.js loads the module
var circle = require("circle.js");
+include("/utils.js");
 puts("The area of a circle of radius 4 is " + circle.area(4));

The contents of circle.js:

@@ -491,7 +492,9 @@ exports.circumference = function (r) { circumference(). To export an object, add to the special exports object. (Alternatively, one can use this instead of exports.) Variables local to the module will be private. In this example the variable PI is -private to circle.js.

+private to circle.js. The function puts() comes from the module +"/utils.js". Because include("/utils.js") was called, puts() is in the +global namespace.

The module path is relative to the file calling require(). That is, circle.js must be in the same directory as foo.js for require() to find it.

@@ -501,6 +504,7 @@ the global namespace. For example:

include("circle.js");
+include("/utils.js");
 puts("The area of a cirlce of radius 4 is " + area(4));

When an absolute path is given to require() or include(), like @@ -2002,7 +2006,7 @@ init (Handle<Object> target)

diff --git a/doc/api.txt b/doc/api.txt index e904ec93213..fa3416366bd 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -265,6 +265,7 @@ The contents of +foo.js+: ---------------------------------------- var circle = require("circle.js"); +include("/utils.js"); puts("The area of a circle of radius 4 is " + circle.area(4)); ---------------------------------------- @@ -286,7 +287,9 @@ The module +circle.js+ has exported the functions +area()+ and +circumference()+. To export an object, add to the special +exports+ object. (Alternatively, one can use +this+ instead of +exports+.) Variables local to the module will be private. In this example the variable +PI+ is -private to +circle.js+. +private to +circle.js+. The function +puts()+ comes from the module ++"/utils.js"+. Because +include("/utils.js")+ was called, +puts()+ is in the +global namespace. The module path is relative to the file calling +require()+. That is, +circle.js+ must be in the same directory as +foo.js+ for +require()+ to @@ -298,6 +301,7 @@ the global namespace. For example: ---------------------------------------- include("circle.js"); +include("/utils.js"); puts("The area of a cirlce of radius 4 is " + area(4)); ---------------------------------------- diff --git a/doc/api.xml b/doc/api.xml index e1677b2ea1b..3d1bcfd7cb6 100644 --- a/doc/api.xml +++ b/doc/api.xml @@ -499,6 +499,7 @@ one-to-one correspondence. As an example, foo.js loads the m circle.js. The contents of foo.js: var circle = require("circle.js"); +include("/utils.js"); puts("The area of a circle of radius 4 is " + circle.area(4)); The contents of circle.js: var PI = 3.14; @@ -514,7 +515,9 @@ exports.circumference = function (r) { circumference(). To export an object, add to the special exports object. (Alternatively, one can use this instead of exports.) Variables local to the module will be private. In this example the variable PI is -private to circle.js. +private to circle.js. The function puts() comes from the module +"/utils.js". Because include("/utils.js") was called, puts() is in the +global namespace. The module path is relative to the file calling require(). That is, circle.js must be in the same directory as foo.js for require() to find it. @@ -522,6 +525,7 @@ find it. returning a namespace object, include() will add the module’s exports into the global namespace. For example: include("circle.js"); +include("/utils.js"); puts("The area of a cirlce of radius 4 is " + area(4)); When an absolute path is given to require() or include(), like require("/mjsunit.js") the module is searched for in the diff --git a/doc/node.1 b/doc/node.1 index 5c6db437adc..c962b89d127 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -397,6 +397,7 @@ The contents of foo\.js: .RS 4 .nf var circle = require("circle\.js"); +include("/utils\.js"); puts("The area of a circle of radius 4 is " + circle\.area(4)); .fi .RE @@ -416,7 +417,7 @@ exports\.circumference = function (r) { }; .fi .RE -The module circle\.js has exported the functions area() and circumference()\. To export an object, add to the special exports object\. (Alternatively, one can use this instead of exports\.) Variables local to the module will be private\. In this example the variable PI is private to circle\.js\. +The module circle\.js has exported the functions area() and circumference()\. To export an object, add to the special exports object\. (Alternatively, one can use this instead of exports\.) Variables local to the module will be private\. In this example the variable PI is private to circle\.js\. The function puts() comes from the module "/utils\.js"\. Because include("/utils\.js") was called, puts() is in the global namespace\. .sp The module path is relative to the file calling require()\. That is, circle\.js must be in the same directory as foo\.js for require() to find it\. .sp @@ -426,6 +427,7 @@ Like require() the function include() also loads a module\. Instead of returning .RS 4 .nf include("circle\.js"); +include("/utils\.js"); puts("The area of a cirlce of radius 4 is " + area(4)); .fi .RE