Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

AMD (Asynchronous Module Definition) support for node.js, specifically define()

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

AMD

Asynchronous Module Definition support for node (a.k.a. define())

See /examples.

Install

npm install AMD

Example1

// bar.js
if (typeof module !== 'undefined' && "exports" in module && typeof define !== 'function') {
    var define = require('AMD').define;
}

define(['http','path','fs'],function(http,path,fs) {
    return {
        hello: 'world'
    };
});

Example2

// baz.js
if (typeof module !== 'undefined' && "exports" in module && typeof define !== 'function') {
    var define = require('AMD').define;
}

define({
    wtf: 'yeehaw'
});

Module use is seamless

console.log(require('./bar'));
console.log(require('./baz'));
Something went wrong with that request. Please try again.