Add a simple example to show how the module system works.

http://code.google.com/p/phantomjs/issues/detail?id=47
1.7
Ariya Hidayat 2012-07-13 07:58:05 -07:00
parent 0ce2974ff7
commit 0632658afe
2 changed files with 12 additions and 0 deletions

4
examples/module.js Normal file
View File

@ -0,0 +1,4 @@
var universe = require('./universe');
universe.start();
console.log('The answer is', universe.answer);
phantom.exit();

8
examples/universe.js Normal file
View File

@ -0,0 +1,8 @@
// This is to be used by module.js example.
exports.answer = 42;
exports.start = function () {
console.log('Starting the universe....');
}