Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
AMD (Asynchronous Module Definition) support for node.js, specifically define()
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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.