Created
May 1, 2013 08:42
-
-
Save peterflynn/5494355 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Require root module | |
*/ | |
define(function (require, exports, module) { | |
"use strict"; | |
var ModuleA = require("packageA/moduleA"), | |
ModuleB = require("./packageB/moduleB"); | |
console.log("Modules loaded:", ModuleA, ModuleB); | |
// Type "ModuleA." or "ModuleB." here: | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample module A - place this in 'packageA' subfolder! | |
*/ | |
define(function (require, exports, module) { | |
"use strict"; | |
function foo(x) { | |
return Math.sqrt(x); | |
} | |
exports.foo = foo; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample module B - place this in 'packageB' subfolder! | |
*/ | |
define(function (require, exports, module) { | |
"use strict"; | |
function bar(x) { | |
return x + " bar!"; | |
} | |
exports.bar = bar; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not working with node modules
eg: var express = require('express')();
app.use --> there is no autocomplete here!!!