diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2009-10-05 17:46:31 +0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2009-10-05 17:46:31 +0400 |
commit | 8185e1fd2501d2d5001d254213c41002440ec7fc (patch) | |
tree | 0f899b26354464329572be87f33d0677a45007b7 /benchmark/run.js | |
parent | 522909bcbf6ff577ddf66b8c07148cf581615157 (diff) |
Remove include() add node.mixin()
include() should not be used by libraries because it will pollute the global
namespace. To discourage this behavior and bring Node more in-line with
the current CommonJS module system, include() is removed.
Small scripts like unit tests often times do want to pollute the global
namespace for ease. To avoid the boiler plate code of
var x = require("/x.js");
var foo = x.foo;
var bar = x.bar;
The function node.mixin() is stolen from jQuery's jQuery.extend. So that it
can be written:
node.mixin(require("/x.js"));
Reference:
http://docs.jquery.com/Utilities/jQuery.extend
http://groups.google.com/group/nodejs/browse_thread/thread/f9ac83e5c11e7e87
Diffstat (limited to 'benchmark/run.js')
-rw-r--r-- | benchmark/run.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/benchmark/run.js b/benchmark/run.js index d9c26686878..869ae55a63b 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -1,6 +1,6 @@ libDir = node.path.join(node.path.dirname(__filename), "../lib"); node.libraryPaths.unshift(libDir); -include("/utils.js"); +node.mixin(require("/utils.js")); var benchmarks = [ "static_http_server.js" , "timers.js" , "process_loop.js" |