diff options
author | isaacs <i@izs.me> | 2011-07-29 22:56:05 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-07-29 22:56:38 +0400 |
commit | 703a1ffe52b66972f38db19fb68e0f70c3dd2631 (patch) | |
tree | c9c3c65d0706a42c990ad62d02d1861722704080 /doc | |
parent | bffb758243ca19d334696a07c8091cf5fb75fe7b (diff) |
Revert "AMD compatibility for node"
This reverts commit 9967c369c9272335bb0343558673b689725c6d7c.
Conflicts:
test/simple/test-module-loading.js
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/modules.markdown | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/doc/api/modules.markdown b/doc/api/modules.markdown index b0e887587c1..ff73933d503 100644 --- a/doc/api/modules.markdown +++ b/doc/api/modules.markdown @@ -266,38 +266,6 @@ Because `module` provides a `filename` property (normally equivalent to `__filename`), the entry point of the current application can be obtained by checking `require.main.filename`. -## AMD Compatibility - -Node's modules have access to a function named `define`, which may be -used to specify the module's return value. This is not necessary in node -programs, but is present in the node API in order to provide -compatibility with module loaders that use the Asynchronous Module -Definition pattern. - -The example module above could be structured like so: - - define(function (require, exports, module) { - var PI = Math.PI; - - exports.area = function (r) { - return PI * r * r; - }; - - exports.circumference = function (r) { - return 2 * PI * r; - }; - }); - -* Only the last argument to `define()` matters. Other module loaders - sometimes use a `define(id, [deps], cb)` pattern, but since this is - not relevant in node programs, the other arguments are ignored. -* If the `define` callback returns a value other than `undefined`, then - that value is assigned to `module.exports`. -* **Important**: Despite being called "AMD", the node module loader **is - in fact synchronous**, and using `define()` does not change this fact. - Node executes the callback immediately, so please plan your programs - accordingly. - ## Addenda: Package Manager Tips The semantics of Node's `require()` function were designed to be general |