Skip to content

Instantly share code, notes, and snippets.

@peterflynn
Created May 1, 2013 08:42
Show Gist options
  • Save peterflynn/5494355 to your computer and use it in GitHub Desktop.
Save peterflynn/5494355 to your computer and use it in GitHub Desktop.
/**
* 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:
});
/**
* 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;
});
/**
* Sample module B - place this in 'packageB' subfolder!
*/
define(function (require, exports, module) {
"use strict";
function bar(x) {
return x + " bar!";
}
exports.bar = bar;
});
@menocomp
Copy link

menocomp commented Mar 1, 2016

This is not working with node modules
eg: var express = require('express')();
app.use --> there is no autocomplete here!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment