diff options
author | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
commit | 7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch) | |
tree | 5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dojo/node.js.uncompressed.js | |
parent | 70db7424e7068701e60cc5bcdfe8f858be508179 (diff) | |
parent | c670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dojo/node.js.uncompressed.js')
-rw-r--r-- | lib/dojo/node.js.uncompressed.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/dojo/node.js.uncompressed.js b/lib/dojo/node.js.uncompressed.js new file mode 100644 index 000000000..e7706668b --- /dev/null +++ b/lib/dojo/node.js.uncompressed.js @@ -0,0 +1,27 @@ +define("dojo/node", ["dojo/has"], function(has){ + if(! 0 ){ + throw new Error("node plugin failed to load because environment is not Node.js"); + } + + return { + // summary: + // This AMD plugin module allows native Node.js modules to be loaded by AMD modules using the Dojo + // loader. Note that this plugin will not work with AMD loaders other than the Dojo loader. + // example: + // | require(["dojo/node!fs"], function(fs){ + // | var fileData = fs.readFileSync("foo.txt", "utf-8"); + // | }); + + load: function(/*string*/ id, /*Function*/ require, /*Function*/ load){ + // summary: + // Standard AMD plugin interface. See https://github.com/amdjs/amdjs-api/wiki/Loader-Plugins + // for information. + + if(!require.nodeRequire){ + throw new Error("Cannot find native require function"); + } + + load(require.nodeRequire(id)); + } + }; +});
\ No newline at end of file |